and at the moment I am doing static parsing with grok csv based on tab separator.
Problem:
The log file struture changes depending on the software version running on the server and this struture is given by the line #fields coming in beginning of each log file (see the sample above).
My idea is to grab the line fields of each log file and do the mapping accordingly but I am not sure how to do it with grok. Anyone can help?
How this search for the log line fields and get the fields from there?
If in the 1st log file you have #Fields: s-dns date time x-duration c-ip c-port c-vx-zone and in the second log file the you have #Fields: s-dns new-field-1 date time x-duration c-ip c-port c-vx-zon new-field-2, so in fact you have 2 extra fields, the same regex will not work, right?
For instance I would like the mapping to happen dinamically like
-log file 1 #Fields: s-dns date time x-duration c-ip c-port c-vx-zone
ac1.lg9ams1d1.cdn 2019-01-14 05:00:01 0.001 172.30.116.146 46684 cdn
When filebeat send the logs to logstash then logstash will read the logs and parse through your regex. Your log will be pass through the regex pattern which match your logs and the same fields will appear on the kibana dashboard.
Yes, same regex will not work for your second log type. You need to write another regex for 2nd log type with the new fields.
Currently you are using CSV to parse the logs, but i gave you regex, using regex you can add your custom fields.
Hope so above point will clear your questions.
Kindly let me know if you still have any other question.
The thing is that I dont know how many fields will come on each log file, therefore I have to get the line fields (in the beggining of each log file) and do the mapping accordingly...ideally what was I looking for is a "magic" that can do that, rather than having to add several regex for each case. Besides this machine is getting logs with the same naming convention from servers with diferent software version...
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.