icinga2 icon indicating copy to clipboard operation
icinga2 copied to clipboard

Eventlog entries over multiple lines

Open rustyricky opened this issue 8 years ago • 3 comments

For example the InfluxDB "authorization failed" errors are written to the log file with a leading line break:

[2018-04-11 14:34:15 +0000] critical/InfluxdbWriter: InfluxDB error message:
authorization failed

There are other events, which also generate multi-line entries, like this one:

[2018-04-11 14:44:32 +0000] critical/ApiListener: Client TLS handshake failed (from [******]:***)
Context:
        (0) Handling new API client connection

This makes the log hard to parse with e.g. logstash, as the subsequent line doesn't match any pattern. If there was a list of all possible multi line events this could be compensated by configuring logstash to merge the lines, but as with InfluxDB I didn't expect this event to generate a second line and logstash couldn't handle this event properly.

In my oppinion it would be great if the main log was restricted to one line per log entry. What do you think or how would you handle this? I'm open to other ideas.

rustyricky avatar Apr 11 '18 14:04 rustyricky

We won't change the logging format, that put first. Have you seen the grok pattern for logstash? This should be able to handle such messages.

https://github.com/Icinga/logstash-grok-pattern

dnsmichi avatar Apr 11 '18 17:04 dnsmichi

I haven't seen that and this seems to be exactly what I'm looking for. Thank you!

rustyricky avatar Apr 12 '18 06:04 rustyricky

In case anyone is searching for this: I've since resolved the multiline messages within filebeat:

- input_type: log
  paths:
    - /var/log/icinga2/icinga2.log
  multiline:
    pattern: '^\['
    negate: true
    match: 'after'

rustyricky avatar May 23 '18 12:05 rustyricky