Commit 53caf71d authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Hotfix missing logstash.

parent 217464b5
Pipeline #37717 passed with stages
in 5 minutes and 53 seconds
......@@ -29,6 +29,8 @@ import nomad.patch # pylint: disable=unused-import
if config.logstash.enabled:
utils.configure_logging()
def initialize_logstash(logger=None, loglevel=logging.DEBUG, **kwargs):
utils.add_logstash_handler(logger)
return logger
......
......@@ -98,10 +98,11 @@ class LogstashFormatter(logstash.formatter.LogstashFormatterBase):
def add_logstash_handler(logger):
has_logstash_handler = any(
isinstance(handler, logstash.TCPLogstashHandler) for handler in logger.handlers)
logstash_handler = next((
handler for handler in logger.handlers
if isinstance(handler, logstash.TCPLogstashHandler)), None)
if not has_logstash_handler:
if logstash_handler is None:
logstash_handler = logstash.TCPLogstashHandler(
config.logstash.host,
config.logstash.tcp_port, version=1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment