Add ability to set debug level
Each contrail service can be configured with its own
level of debug. These services can be configured:
contrail-collector
contrail-query-engine
contrail-topology
contrail-snmp-collector
contrail-vrouter-agent
contrail-device-manager
contrail-analytics-api
contrail-alarm-gen
contrail-dns
contrail-svc-monitor
contrail-control
contrail-api
contrail-schema
Closes-bug: #PROD-34313
Change-Id: Ic20e7ac45797a82154ef124aebbab052b5b01b5f
diff --git a/README.rst b/README.rst
index 501f90c..72b138a 100644
--- a/README.rst
+++ b/README.rst
@@ -832,6 +832,40 @@
override_rpf_default_by: 'disable'
...
+Configure log level for Contrail services
+-----------------------------------------
+
+For OpenContrail 4.0 and 4.1 formula supports setting level of
+the log level for contrail services. Default value of debug level
+is `SYS_NOTICE`.
+
+.. code-block:: yaml
+
+ opencontrail:
+ ...
+ config:
+ log_level:
+ api: SYS_NOTICE
+ device_manager: SYS_NOTICE
+ schema: SYS_NOTICE
+ svc_monitor: SYS_NOTICE
+ collector:
+ log_level:
+ alarm: SYS_NOTICE
+ analytics_api: SYS_NOTICE
+ collector: SYS_NOTICE
+ query_engine: SYS_NOTICE
+ snmp: SYS_NOTICE
+ topology: SYS_NOTICE
+ compute:
+ log_level:
+ agent: SYS_NOTICE
+ control:
+ log_level:
+ control: SYS_NOTICE
+ dns: SYS_NOTICE
+ ...
+
Cassandra GC logging
--------------------
diff --git a/opencontrail/files/4.0/contrail-alarm-gen.conf b/opencontrail/files/4.0/contrail-alarm-gen.conf
index 00b957c..206908e 100644
--- a/opencontrail/files/4.0/contrail-alarm-gen.conf
+++ b/opencontrail/files/4.0/contrail-alarm-gen.conf
@@ -4,7 +4,7 @@
collectors = {% for member in collector.analytics.members %}{{ member.host }}:8086 {% endfor %}
#http_server_port = 5995
log_local = 1
-log_level = SYS_NOTICE
+log_level = {{ collector.log_level.alarm }}
#log_category =
log_file = /var/log/contrail/contrail-alarm-gen.log
kafka_broker_list = {% for member in collector.database.members %}{{ member.host }}:9092 {% endfor %}
diff --git a/opencontrail/files/4.0/contrail-analytics-api.conf b/opencontrail/files/4.0/contrail-analytics-api.conf
index 98ba5ed..46c78a5 100644
--- a/opencontrail/files/4.0/contrail-analytics-api.conf
+++ b/opencontrail/files/4.0/contrail-analytics-api.conf
@@ -9,7 +9,7 @@
rest_api_port = {{ collector.bind.get('port', '8081') }}
rest_api_ip = 0.0.0.0
log_local = 1
-log_level = SYS_NOTICE
+log_level = {{ collector.log_level.analytics_api }}
log_category =
log_file = /var/log/contrail/contrail-analytics-api.log
diff --git a/opencontrail/files/4.0/contrail-api.conf b/opencontrail/files/4.0/contrail-api.conf
index 62645d8..20ac10f 100644
--- a/opencontrail/files/4.0/contrail-api.conf
+++ b/opencontrail/files/4.0/contrail-api.conf
@@ -17,7 +17,7 @@
{%- endif %}
log_file=/var/log/contrail/contrail-api.log
log_local=1
-log_level=SYS_NOTICE
+log_level={{ config.log_level.api }}
#zk_server_ip=10.0.102.31:2181,10.0.102.32:2181,10.0.102.33:2181
zk_server_ip={% for member in config.database.members %}{{ member.host }}:2181{% if not loop.last %},{% endif %}{% endfor %}
redis_server_ip=$__contrail_redis_ip__
diff --git a/opencontrail/files/4.0/contrail-collector.conf b/opencontrail/files/4.0/contrail-collector.conf
index 505ad1d..0777577 100644
--- a/opencontrail/files/4.0/contrail-collector.conf
+++ b/opencontrail/files/4.0/contrail-collector.conf
@@ -41,7 +41,7 @@
log_file=/var/log/contrail/contrail-collector.log
# log_files_count=10
# log_file_size=1048576 # 1MB
-log_level=SYS_NOTICE
+log_level={{ collector.log_level.collector }}
log_local=1
# TCP and UDP ports to listen on for receiving syslog messages. -1 to disable.
diff --git a/opencontrail/files/4.0/contrail-control.conf b/opencontrail/files/4.0/contrail-control.conf
index 4962e30..9d3248a 100644
--- a/opencontrail/files/4.0/contrail-control.conf
+++ b/opencontrail/files/4.0/contrail-control.conf
@@ -24,7 +24,7 @@
log_file=/var/log/contrail/contrail-control.log
# log_files_count=10
# log_file_size=10485760 # 10MB
-log_level=SYS_NOTICE
+log_level={{ control.log_level.control }}
log_local=1
# test_mode=0
{%- if control.xmpp.tls.enabled %}
diff --git a/opencontrail/files/4.0/contrail-device-manager.conf b/opencontrail/files/4.0/contrail-device-manager.conf
index 7125305..88ecfc9 100644
--- a/opencontrail/files/4.0/contrail-device-manager.conf
+++ b/opencontrail/files/4.0/contrail-device-manager.conf
@@ -26,7 +26,7 @@
cassandra_server_list={% for member in config.database.members %}{{ member.host }}:9161 {% endfor %}
collectors = {% for member in config.analytics.members %}{{ member.host }}:8086 {% endfor %}
log_local=1
-log_level=SYS_NOTICE
+log_level={{ config.log_level.device_manager }}
{%- if config.get('sandesh_send_rate_limits', {}).get('device_manager') %}
sandesh_send_rate_limit={{ config.sandesh_send_rate_limits.device_manager }}
{%- elif config.get('sandesh_send_rate_limits', {}).get('global') %}
diff --git a/opencontrail/files/4.0/contrail-dns.conf b/opencontrail/files/4.0/contrail-dns.conf
index 7a4ee8a..6e2d206 100644
--- a/opencontrail/files/4.0/contrail-dns.conf
+++ b/opencontrail/files/4.0/contrail-dns.conf
@@ -29,7 +29,7 @@
log_file=/var/log/contrail/contrail-dns.log
# log_files_count=10
# log_file_size=1048576 # 1MB
-log_level=SYS_NOTICE
+log_level={{ control.log_level.dns }}
log_local=1
# test_mode=0
# log_property_file= # log4cplus property file
diff --git a/opencontrail/files/4.0/contrail-query-engine.conf b/opencontrail/files/4.0/contrail-query-engine.conf
index f147212..1ad9fca 100644
--- a/opencontrail/files/4.0/contrail-query-engine.conf
+++ b/opencontrail/files/4.0/contrail-query-engine.conf
@@ -17,7 +17,7 @@
log_file=/var/log/contrail/contrail-query-engine.log
# log_files_count=10
# log_file_size=1048576 # 1MB
-log_level=SYS_NOTICE
+log_level={{ collector.log_level.query_engine }}
log_local=1
# test_mode=0
# max_slice=100
diff --git a/opencontrail/files/4.0/contrail-schema.conf b/opencontrail/files/4.0/contrail-schema.conf
index 63f05df..81829ad 100644
--- a/opencontrail/files/4.0/contrail-schema.conf
+++ b/opencontrail/files/4.0/contrail-schema.conf
@@ -10,7 +10,7 @@
log_file=/var/log/contrail/contrail-schema.log
cassandra_server_list={% for member in config.database.members %}{{ member.host }}:9161 {% endfor %}
log_local=1
-log_level=SYS_NOTICE
+log_level={{ config.log_level.schema }}
{%- if config.message_queue.members is defined %}
rabbit_server={{ config.message_queue.members|join(',',attribute='host') }}
rabbit_ha_mode=True
diff --git a/opencontrail/files/4.0/contrail-snmp-collector.conf b/opencontrail/files/4.0/contrail-snmp-collector.conf
index 27914a4..92d72b5 100644
--- a/opencontrail/files/4.0/contrail-snmp-collector.conf
+++ b/opencontrail/files/4.0/contrail-snmp-collector.conf
@@ -4,7 +4,7 @@
#fast_scan_frequency=60
#http_server_port=5920
log_local=1
-log_level=SYS_NOTICE
+log_level={{ collector.log_level.snmp }}
log_file=/var/log/contrail/contrail-snmp-collector.log
zookeeper = {% for member in collector.database.members %}{{ member.host }}:2182{% if not loop.last %},{% endif %}{% endfor %}
#scan_frequency=600
diff --git a/opencontrail/files/4.0/contrail-svc-monitor.conf b/opencontrail/files/4.0/contrail-svc-monitor.conf
index 3a018b5..166a854 100644
--- a/opencontrail/files/4.0/contrail-svc-monitor.conf
+++ b/opencontrail/files/4.0/contrail-svc-monitor.conf
@@ -12,7 +12,7 @@
cassandra_server_list={% for member in config.database.members %}{{ member.host }}:9161 {% endfor %}
#nova_endpoint_type=publicURL
log_local=1
-log_level=SYS_NOTICE
+log_level={{ config.log_level.svc_monitor }}
{%- if config.message_queue.members is defined %}
rabbit_server={{ config.message_queue.members|join(',',attribute='host') }}
rabbit_ha_mode=True
diff --git a/opencontrail/files/4.0/contrail-topology.conf b/opencontrail/files/4.0/contrail-topology.conf
index 4ac9dc5..87272bd 100644
--- a/opencontrail/files/4.0/contrail-topology.conf
+++ b/opencontrail/files/4.0/contrail-topology.conf
@@ -6,7 +6,7 @@
#http_server_port=5921
log_local=1
-log_level=SYS_NOTICE
+log_level={{ collector.log_level.topology }}
log_file=/var/log/contrail/contrail-topology.log
zookeeper = {% for member in collector.database.members %}{{ member.host }}:2182{% if not loop.last %},{% endif %}{% endfor %}
diff --git a/opencontrail/files/4.0/contrail-vrouter-agent.conf b/opencontrail/files/4.0/contrail-vrouter-agent.conf
index 5f0e29c..8b376f1 100644
--- a/opencontrail/files/4.0/contrail-vrouter-agent.conf
+++ b/opencontrail/files/4.0/contrail-vrouter-agent.conf
@@ -77,7 +77,7 @@
# Log severity levels. Possible values are SYS_EMERG, SYS_ALERT, SYS_CRIT,
# SYS_ERR, SYS_WARN, SYS_NOTICE, SYS_INFO and SYS_DEBUG. Default is SYS_DEBUG
-log_level=SYS_NOTICE
+log_level={{ compute.log_level.agent }}
# Enable/Disable local file logging. Possible values are 0 (disable) and 1 (enable)
log_local=1
diff --git a/opencontrail/map.jinja b/opencontrail/map.jinja
index def00f4..2f9dc93 100644
--- a/opencontrail/map.jinja
+++ b/opencontrail/map.jinja
@@ -30,6 +30,13 @@
container_name:
{{ pillar.docker.client.compose.opencontrail.service.analytics.container_name }}
{%- endif%}
+ log_level:
+ alarm: SYS_NOTICE
+ analytics_api: SYS_NOTICE
+ collector: SYS_NOTICE
+ query_engine: SYS_NOTICE
+ snmp: SYS_NOTICE
+ topology: SYS_NOTICE
RedHat:
pkgs:
['contrail-analytics']
@@ -70,6 +77,8 @@
ca_cert_file: /etc/contrail/ssl/certs/ca-cert.pem
dpdk:
enabled: False
+ log_level:
+ agent: SYS_NOTICE
RedHat:
pkgs:
['contrail-openstack-vrouter', 'contrail-utils', 'haproxy', 'contrail-vrouter-source']
@@ -111,6 +120,11 @@
container_name:
{{ pillar.docker.client.compose.opencontrail.service.controller.container_name }}
{%- endif%}
+ log_level:
+ api: SYS_NOTICE
+ device_manager: SYS_NOTICE
+ schema: SYS_NOTICE
+ svc_monitor: SYS_NOTICE
RedHat:
pkgs:
['contrail-openstack-config']
@@ -146,6 +160,9 @@
cert_file: /etc/contrail/ssl/certs/server.pem
key_file: /etc/contrail/ssl/private/server-privkey.pem
ca_cert_file: /etc/contrail/ssl/certs/ca-cert.pem
+ log_level:
+ control: SYS_NOTICE
+ dns: SYS_NOTICE
RedHat:
pkgs:
['contrail-openstack-control']