Hi again DMFA,
We are sorry for the delay, we were analyzing your case.
So, first of all, I would recommend you always use the logall_json option, when you want to debug the arriving logs, instead of the logall one, as the json configuration provides much more information related to the incoming events.
The second point would be, for you to know, that the actual log is not:
2022 Jan 31 13:31:47 st.localdomain->192.168.1.205 2022-01-31T07:28:26.595Z localhost.localdomain Hostd: info hostd[1050772] [Originator@6876 sub=Default opID=esxui-85bf-9276] Rejected password for user root from 192.168.1.200
but:
2022-01-31T07:28:26.595Z localhost.localdomain Hostd: info hostd[1050772] [Originator@6876 sub=Default opID=esxui-85bf-9276] Rejected password for user root from 192.168.1.200
The first part (2022 Jan 31 13:31:47 st.localdomain->192.168.1.205) is added by Wazuh, so if you are trying to create a custom rule/decoder you should always do it using the raw log (full_log field of the events written on the archives.json file) and not the enriched one.
So, in this case, I have tested the raw log with our wazuh-logtest tool and this is the output:
# /var/ossec/bin/wazuh-logtest
Starting wazuh-logtest v4.2.5
Type one log per line
2022-01-31T07:28:26.595Z localhost.localdomain Hostd: info hostd[1050772] [Originator@6876 sub=Default opID=esxui-85bf-9276] Rejected password for user root from 192.168.1.200
**Phase 1: Completed pre-decoding.
full event: '2022-01-31T07:28:26.595Z localhost.localdomain Hostd: info hostd[1050772] [Originator@6876 sub=Default opID=esxui-85bf-9276] Rejected password for user root from 192.168.1.200'
timestamp: '2022-01-31T07:28:26.595Z localh'
program_name: 'Hostd'
**Phase 2: Completed decoding.
No decoder matched.
This tells us that the predecoder is not working properly, as it cannot correctly strip the timestamp. So, there is a Wazuh limitation here, as the timestamp is wrong from the start and it won’t be indexed in Kibana no matter if your custom rules and decoders are correct or not. You can see that there is an open issue on Github related to this problem: https://github.com/wazuh/wazuh/issues/3525
In order to skip this limitation, are you able to change from the source the timestamp format?
I will be waiting for your reply,
Mariano Koremblum
Hi @cleberb,
I agree. The pre-decoding stage is currently a static decoder written in C, we can't change or disable it.
It would be better improving the regex engine and allowing the user to define custom pre-decoders.
That's not an easy task but let me mark this issue as enhancement so we will discuss it with the team.
Thanks for your feedback.
Regards.
I am sorry to tell you that there are no workarounds to directly ingest these kinds of logs.
What you could do is to set up a rsyslog server, on the same machine where your Wazuh manager is installed, to receive these remote logs and store them in a local file. Then, you can monitor this local file with the Wazuh manager as follows.
Set the following configuration block on your manager’s ossec.conf file:
What the out_format will cause is to add information to the raw log ($(log)). So, if you have the following raw log:
2022-01-31T07:28:26.595Z localhost.localdomain Hostd: info hostd[1050772] [Originator@6876 sub=Default opID=esxui-85bf-9276] Rejected password for user root from 192.168.1.200
What you will get to be processed by Wazuh would end up being something like this (timestamp format might be different):
Feb 01 11:45:01 localhost Hostd: 2022-01-31T07:28:26.595Z localhost.localdomain Hostd: info hostd[1050772] [Originator@6876 sub=Default opID=esxui-85bf-9276] Rejected password for user root from 192.168.1.200
The date is added when the log is collected from the localfile, so it will differ from the actual one that was inserted when the log was produced in the source, but it will be a valid timestamp format that the Wazuh preprocessor can digest.
Then you should create your custom rules and decoders taking into account the new format of the log.
In this case, given the decoder that you have shared with us before, you would have something like the following:And the output, which is obtained by inspecting the log (the second one), on wazuh-logtest will be the following:
You should take into account that, in the second decoder, the child one, the regex field only takes effect on the $(log) part of the full log.