From e0ff9295e633f8dc1df04f8829b4981bca77b036 Mon Sep 17 00:00:00 2001 From: stedif <stefano.difrischia@inaf.it> Date: Tue, 4 Oct 2022 17:38:09 +0200 Subject: [PATCH] L2SS-970: replace ELK with Loki in lofar_logging --- .../tangostationcontrol/common/lofar_logging.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/common/lofar_logging.py b/tangostationcontrol/tangostationcontrol/common/lofar_logging.py index 89ab11c0d..f55122e9f 100644 --- a/tangostationcontrol/tangostationcontrol/common/lofar_logging.py +++ b/tangostationcontrol/tangostationcontrol/common/lofar_logging.py @@ -56,7 +56,7 @@ class LogSuppressErrorSpam(logging.Formatter): self.error_suppress_interval = error_suppress_interval def is_error_to_suppress(self, record): - # Errors occuring by not being able to connect to the ELK stack, f.e. because it is down. + # Errors occuring by not being able to connect to the log processing container, f.e. because it is down. return record.name == "LogProcessingWorker" and record.msg == "An error occurred while sending events: %s" def filter(self, record): @@ -105,7 +105,7 @@ class LogAnnotator(logging.Formatter): def configure_logger(logger: logging.Logger=None, log_extra=None, debug=False): """ Configure the given logger (or root if None) to: - - send logs to the ELK stack + - send logs to Loki through Logstash - send logs to Tango - send logs to stdout """ @@ -128,7 +128,7 @@ def configure_logger(logger: logging.Logger=None, log_extra=None, debug=False): # don't spam debug messages when fetching URLs logging.getLogger("urllib3").setLevel(logging.INFO) - # don't spam error messages when having trouble connecting to ELK + # don't spam error messages when having connection troubles logging.getLogger("LogProcessingWorker").setLevel(logging.CRITICAL) # for now, also log to stderr @@ -151,12 +151,12 @@ def configure_logger(logger: logging.Logger=None, log_extra=None, debug=False): if debug: return logger - # Log to ELK stack + # Log to Logstash-Loki try: from logstash_async.handler import AsynchronousLogstashHandler, LogstashFormatter - # log to the tcp_input of logstash in our ELK stack - handler = AsynchronousLogstashHandler("elk", 5959, database_path='/tmp/lofar_pending_log_messages.db') + # log to the tcp_input of logstash in our logstash-loki container + handler = AsynchronousLogstashHandler("logstash-loki", 5959, database_path='/tmp/lofar_pending_log_messages.db') # configure log messages formatter = LogstashFormatter(extra=log_extra, tags=["python", "lofar"]) @@ -167,9 +167,9 @@ def configure_logger(logger: logging.Logger=None, log_extra=None, debug=False): # install the handler logger.addHandler(handler) except ImportError: - logger.exception("Cannot forward logs to ELK: logstash_async module not found.") + logger.exception("Cannot forward logs to Logstash-Loki: logstash_async module not found.") except Exception: - logger.exception("Cannot forward logs to ELK.") + logger.exception("Cannot forward logs to Logstash-Loki.") # Don't log to Tango to reduce log spam """ -- GitLab