Buenas compañeros, tengo que realizar un SIEM con un cliente que el cual, un servidor envíe logs hacia un ambiente ELK, pero aquí tenemos dos problemas.
El archivo que necesitamos enviar está con extensión .file, o sea no tiene extension.
El archivo por dentro tiene un formato algo diferente a como son los logs normalmente, el formato sería algo así:
Así tal cual con los espacios entre si y todos en una misma linea. Ahora, ya se intentó en logstash con filtros para que ver si se podía parsear, pero no hubo cambios a la hora de que kibana los indexara.
Entiendo el español, pero no escribo muy bien en ese idioma, te respondo en inglés.
This file you are working with is a SAP Audit file and it is very bad to work for two reasons:
It does not have a line break, all the events are written without line breaks between day, if you run, for example cat file | wc -l, to count the lines of the file, it will return 0.
The fields in the event have a fixed size in bytes, the entire event has 200 bytes and each field has a fixed lenght size in bytes.
Basically you won't be able to use logstash to parse this file correctly as it does not even have a line break in the end, you will need to build a tool to convert it to a more readable format, something use python for example.
I built a python script while working on a previous employer, but unfortunately I do not have access to this script anymore, what you need to do is to read the file in chunks of 200 bytes and split the fields based on their fixed-lenght sizes.
You can read more about this format in the File Format part of this blog post.
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.