Hi there,
given two stored patterns and if they are linked with “|”, one of the stored patterns matches a certain string and the other stored pattern does partly. Then the result depends on the order of the stored patterns. The result is only right if the fully matching pattern is mentioned last. Which also means its wrong in every other case. AND there is no “right order” as order breaks it for other inputs. Maybe I’m missing something here but if not; this would mean Graylog is no longer an option for my team as we depend on working with syslogs in this manner.
The main Question is: Does chaining nested GROK patterns with " | " not work with the current Graylog GROK engine or am I misunderstanding something.
Example :
imap-login: proxy(testuser): disconnecting 8.8.8.8 (Disconnected by client): user=<testuser>, method=PLAIN, rip=8.8.8.8, lip=127.0.0.1, TLS, session=<zlgOH3xdHQBScWJe>
Pattern = Result:
%{DOVECOT_PROXY1} = Nothing, no match (correct)
%{DOVECOT_PROXY2} = Full match. All fields filled (correct)
(%{DOVECOT_PROXY1}|%{DOVECOT_PROXY2}) = Full match. All fields filled (correct)
(%{DOVECOT_PROXY2}|%{DOVECOT_PROXY1}) = Broken / Quirky result
It is fully reproducible in the extractor setup/test if you take the following data and patterns
Full syslog message:
<22>1 2017-11-08T18:42:22+01:00 dovecot-proxy dovecot - - - imap-login: proxy(testuser): disconnecting 8.8.8.8 (Disconnected by client): user=, method=PLAIN, rip=8.8.8.8, lip=127.0.0.1, TLS, session=<zlgOH3xdHQBScWJe>
GROK Patterns:
(Taken from github)
DOVECOT_PROXY1 %{WORD:proto}-login: %{WORD:proxy}\(%{USERNAME}\): started %{WORD:proxy_start} to %{IPORHOST:proxyto_host}:%{POSINT:proxyto_port}: user=<(%{USERNAME}(@%{HOSTNAME})?)?>, method=%{WORD:method}, rip=%{IP:rip}, lip=%{IP:lip}(, %{WORD:crypto})?, session=<%{DATA:session}>
DOVECOT_PROXY2 %{WORD:proto}-login: %{WORD:proxy}\(%{USERNAME}\): %{WORD:conn_status} %{IPORHOST} \(%{DATA:status_message}\): user=<(%{USERNAME}(@%{HOSTNAME})?)?>, method=%{WORD:method}, rip=%{IP:rip}, lip=%{IP:lip}(, %{WORD:crypto})?, session=<%{DATA:session}>