Commit 41112fe9 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Process all structlog data keys.

parent 0a6a7907
Pipeline #37462 passed with stages
in 6 minutes and 29 seconds
......@@ -77,25 +77,20 @@ class LogstashFormatter(logstash.formatter.LogstashFormatterBase):
'logger_name': record.name,
}
message.update(structlog)
# Add extra fields
if record.name.startswith('nomad'):
for key, value in self.get_extra_fields(record).items():
if key in ['event']:
pass
elif key in LogstashFormatter.root_keys:
key = 'nomad.%s' % key
else:
key = '%s.%s' % (record.name, key)
message[key] = value
else:
message.update(self.get_extra_fields(record))
# If exception, add debug info
if record.exc_info:
message.update(self.get_debug_fields(record))
data_sets = [structlog, self.get_extra_fields(record), self.get_debug_fields(record)]
for data in data_sets:
if record.name.startswith('nomad'):
for key, value in data.items():
if key in ['event', 'stack_info']:
pass
elif key in LogstashFormatter.root_keys:
key = 'nomad.%s' % key
else:
key = '%s.%s' % (record.name, key)
message[key] = value
else:
message.update(data)
return self.serialize(message)
......
Supports Markdown
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