Dear sirs
I have a question about the grok plugin:
I have some logs which are built in the following way and my problem is that the order of my fields can mutate from log to log (in the
example here I should extract from all the logs both the "user id" and the "document id"). So I am wondering how I should build the grok
pattern to handle both the logs hopeing there is a better solution of writing two different patterns (or how to write a regex to find
a specific attribute anywhere in the log without knowing before its exact position)
2019-01-15 INFO myclass - mymethod: user id: 12345 custom message 1 document id: 843572309845
2019-01-15 WARN myclass - mymethod1: document id: 43543534 custom message 2 user id: 98589348543 custom message 3 agent id: 98435734
the expected result is:
date: 2019-01-15
level: INFO
class: myclass
method: mymethod
message: user id: 12345 custom message 1 document id: 843572309845
userId: 12345
documentId: 843572309845
date: 2019-01-15
level: WARN
class: myclass
method: mymethod1
message: document id: 43543534 custom message 2 user id: 98589348543 custom message 3 agent id: 98435734
userId: 98589348543
documentId: 43543534
agentId: 98589348543
Looking forward for your answer, thank you.