Fix kafka logs not being deleted
Change-Id: I5269332bbe780422a73f6845e5efbf1598b0c1b3
Closes-Bug: PROD-16382
diff --git a/opencontrail/control/analytics.yml b/opencontrail/control/analytics.yml
index 8065742..6e56936 100644
--- a/opencontrail/control/analytics.yml
+++ b/opencontrail/control/analytics.yml
@@ -4,6 +4,9 @@
- service.opencontrail.control.analytics
- system.haproxy.proxy.listen.opencontrail.analytics
parameters:
+ _param:
+ opencontrail_kafka_log_cleanup_mtime: '+7'
+ opencontrail_kafka_log_cleanup_dir: '/usr/share/kafka/logs/'
# Temprorary fix for MOS9 packages to pin old version of kafka
linux:
system:
@@ -17,6 +20,12 @@
kernel:
modules:
- nf_conntrack_ipv4
+ job:
+ kafka_logs_cleanup:
+ command: "find ${_param:opencontrail_kafka_log_cleanup_dir} -name '*.log.*' -type f -mtime ${_param:opencontrail_kafka_log_cleanup_mtime} -exec rm {} \\;"
+ identifier: kafka_logs_cleanup
+ hour: 0
+ minute: 0
opencontrail:
common:
identity:
diff --git a/opencontrail/control/analytics4_0.yml b/opencontrail/control/analytics4_0.yml
index a426e02..c38e06a 100644
--- a/opencontrail/control/analytics4_0.yml
+++ b/opencontrail/control/analytics4_0.yml
@@ -5,6 +5,8 @@
- system.haproxy.proxy.listen.opencontrail.analytics
parameters:
_param:
+ opencontrail_kafka_log_cleanup_mtime: '+7'
+ opencontrail_kafka_log_cleanup_dir: '/usr/share/kafka/logs/'
opencontrail_version: 4.0
linux_repo_contrail_component: oc40
opencontrail_message_queue_node01_address: ${_param:openstack_message_queue_node01_address}
@@ -19,6 +21,12 @@
kernel:
modules:
- nf_conntrack_ipv4
+ job:
+ kafka_logs_cleanup:
+ command: "find ${_param:opencontrail_kafka_log_cleanup_dir} -name '*.log.*' -type f -mtime ${_param:opencontrail_kafka_log_cleanup_mtime} -exec rm {} \\;"
+ identifier: kafka_logs_cleanup
+ hour: 0
+ minute: 0
opencontrail:
common:
config_only: true
@@ -84,6 +92,7 @@
- /usr/share/kafka/config/server.properties:/usr/share/kafka/config/server.properties
- /usr/share/kafka/config/consumer.properties:/usr/share/kafka/config/consumer.properties
- /usr/share/kafka/config/zookeeper.properties:/usr/share/kafka/config/zookeeper.properties
+ - /usr/share/kafka/logs:/usr/share/kafka/logs
- /etc/zookeeper/conf/zoo_analytics.cfg:/etc/zookeeper/conf/zoo.cfg
- /etc/zookeeper/conf/log4j.properties:/etc/zookeeper/conf/log4j.properties
network_mode: "host"
diff --git a/opencontrail/control/cluster.yml b/opencontrail/control/cluster.yml
index a4126d6..28c12c4 100644
--- a/opencontrail/control/cluster.yml
+++ b/opencontrail/control/cluster.yml
@@ -5,6 +5,9 @@
- system.haproxy.proxy.listen.opencontrail.control
- system.haproxy.proxy.listen.opencontrail.analytics
parameters:
+ _param:
+ opencontrail_kafka_log_cleanup_mtime: '+7'
+ opencontrail_kafka_log_cleanup_dir: '/usr/share/kafka/logs/'
# Temprorary fix for MOS9 packages to pin old version of kafka
linux:
system:
@@ -16,6 +19,12 @@
kernel:
modules:
- nf_conntrack_ipv4
+ job:
+ kafka_logs_cleanup:
+ command: "find ${_param:opencontrail_kafka_log_cleanup_dir} -name '*.log.*' -type f -mtime ${_param:opencontrail_kafka_log_cleanup_mtime} -exec rm {} \\;"
+ identifier: kafka_logs_cleanup
+ hour: 0
+ minute: 0
opencontrail:
web:
database:
diff --git a/opencontrail/control/cluster4_0.yml b/opencontrail/control/cluster4_0.yml
index 9796930..92a6a17 100644
--- a/opencontrail/control/cluster4_0.yml
+++ b/opencontrail/control/cluster4_0.yml
@@ -6,6 +6,8 @@
- system.haproxy.proxy.listen.opencontrail.analytics
parameters:
_param:
+ opencontrail_kafka_log_cleanup_mtime: '+7'
+ opencontrail_kafka_log_cleanup_dir: '/usr/share/kafka/logs/'
opencontrail_version: 4.0
linux_repo_contrail_component: oc40
opencontrail_message_queue_node01_address: ${_param:openstack_control_node01_address}
@@ -22,6 +24,12 @@
kernel:
modules:
- nf_conntrack_ipv4
+ job:
+ kafka_logs_cleanup:
+ command: "find ${_param:opencontrail_kafka_log_cleanup_dir} -name '*.log.*' -type f -mtime ${_param:opencontrail_kafka_log_cleanup_mtime} -exec rm {} \\;"
+ identifier: kafka_logs_cleanup
+ hour: 0
+ minute: 0
opencontrail:
common:
config_only: true
@@ -155,6 +163,7 @@
- /usr/share/kafka/config/server.properties:/usr/share/kafka/config/server.properties
- /usr/share/kafka/config/consumer.properties:/usr/share/kafka/config/consumer.properties
- /usr/share/kafka/config/zookeeper.properties:/usr/share/kafka/config/zookeeper.properties
+ - /usr/share/kafka/logs:/usr/share/kafka/logs
- /etc/zookeeper/conf/zoo_analytics.cfg:/etc/zookeeper/conf/zoo.cfg
- /etc/zookeeper/conf/log4j.properties:/etc/zookeeper/conf/log4j.properties
network_mode: "host"
diff --git a/opencontrail/control/single.yml b/opencontrail/control/single.yml
index 064418e..2ba745b 100644
--- a/opencontrail/control/single.yml
+++ b/opencontrail/control/single.yml
@@ -2,6 +2,9 @@
- service.opencontrail.control.single
- service.haproxy.proxy.single
parameters:
+ _param:
+ opencontrail_kafka_log_cleanup_mtime: '+7'
+ opencontrail_kafka_log_cleanup_dir: '/usr/share/kafka/logs/'
# Temprorary fix for MOS9 packages to pin old version of kafka
linux:
system:
@@ -15,6 +18,12 @@
kernel:
modules:
- nf_conntrack_ipv4
+ job:
+ kafka_logs_cleanup:
+ command: "find ${_param:opencontrail_kafka_log_cleanup_dir} -name '*.log.*' -type f -mtime ${_param:opencontrail_kafka_log_cleanup_mtime} -exec rm {} \\;"
+ identifier: kafka_logs_cleanup
+ hour: 0
+ minute: 0
haproxy:
proxy:
listen:
diff --git a/opencontrail/control/single4_0.yml b/opencontrail/control/single4_0.yml
index ded5289..a9ae787 100644
--- a/opencontrail/control/single4_0.yml
+++ b/opencontrail/control/single4_0.yml
@@ -3,6 +3,8 @@
- service.haproxy.proxy.single
parameters:
_param:
+ opencontrail_kafka_log_cleanup_mtime: '+7'
+ opencontrail_kafka_log_cleanup_dir: '/usr/share/kafka/logs/'
opencontrail_version: 4.0
linux_repo_contrail_component: oc40
opencontrail_analytics_image: docker-prod-local.artifactory.mirantis.com/opencontrail/opencontrail-analytics
@@ -17,6 +19,12 @@
kernel:
modules:
- nf_conntrack_ipv4
+ job:
+ kafka_logs_cleanup:
+ command: "find ${_param:opencontrail_kafka_log_cleanup_dir} -name '*.log.*' -type f -mtime ${_param:opencontrail_kafka_log_cleanup_mtime} -exec rm {} \\;"
+ identifier: kafka_logs_cleanup
+ hour: 0
+ minute: 0
haproxy:
proxy:
listen:
@@ -186,6 +194,7 @@
- /usr/share/kafka/config/server.properties:/usr/share/kafka/config/server.properties
- /usr/share/kafka/config/consumer.properties:/usr/share/kafka/config/consumer.properties
- /usr/share/kafka/config/zookeeper.properties:/usr/share/kafka/config/zookeeper.properties
+ - /usr/share/kafka/logs:/usr/share/kafka/logs
- /etc/zookeeper/conf/zoo_analytics.cfg:/etc/zookeeper/conf/zoo.cfg
- /etc/zookeeper/conf/log4j.properties:/etc/zookeeper/conf/log4j.properties
network_mode: "host"