Hello,
I am currently stuck on a parsing topic.
I am looking with a single match to recover several information from the same information to already capture.
I'm working on DNS log:
Jan 7 13:49:02 192.168.10.254 unbound: [33534:0] info: 192.168.1.122 proxy.gamestream.nvidia.com. A IN
I need to retrieve the following information from the same log:
The main issue here is that, by default, grok will stop testing after the first match. You can alter this just by adding the corresponding option break_on_match set to false.
You can also obtain the same result in different ways:
Nested grok custom patterns. Not very readable but it can be done in a single line.
As you use a custom patterns file, you could add semantic (fields) inside the patterns and use some kind of pattern composition like the common apache log format (one of the default patterns). Not too readable either: some problem logic would be outside of the filter file.
Start with the bigger field (FQDN) extraction in one grok and add another independent grok filter just for this field (match a couple of patterns for FQDN field). I consider it the most readable solution.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.