Reduces kafka log level to WARN 39/6439/2
authorBenjamin Diaz <bdiaz@whitestack.com>
Tue, 28 Aug 2018 14:32:06 +0000 (11:32 -0300)
committerBenjamin Diaz <bdiaz@whitestack.com>
Tue, 28 Aug 2018 16:05:47 +0000 (13:05 -0300)
Kafka was producing a considerable amount of logs, which in some cases
caused disk space issues.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: Id9a392ae881a8fff6ab8fe33b044370557adfeeb

policy_module/osm_policy_module/cmd/policy_module_agent.py

index b9d6ca9..ac03167 100644 (file)
@@ -55,6 +55,13 @@ def main():
         root_logger = logging.getLogger()
         root_logger.addHandler(logstash.TCPLogstashHandler(logstash_host, logstash_port, version=1))
         root_logger.info("Logstash handler configured.")
+    kafka_logger = logging.getLogger('kafka')
+    kafka_logger.setLevel(logging.WARN)
+    kafka_formatter = logging.Formatter(
+        '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+    kafka_handler = logging.StreamHandler(sys.stdout)
+    kafka_handler.setFormatter(kafka_formatter)
+    kafka_logger.addHandler(kafka_handler)
     log = logging.getLogger(__name__)
     log.info("Config: %s", cfg)
     log.info("Syncing database...")