Hi Roberto,
Does it happen only with this rule+decoder or with other kinds of alerts as well? Do you see any related Warning/Error message on your ossec.log file?
Roberto,
Could you please share with us your ossec.conf file?
Could yo please set <logall_json>yes</logall_json> on your ossec.conf file, and then, if possible, send the previously mentioned log to the manager’s UDP syslog port?
You can achieve this by using the nc program on a Linux machine (which must come from an allowed IP) doing the following:
nc -w0 -u YOUR_MANAGER_IP 514 <<< "2021 Dec 27 18:16:30 CLOUD->192.168.0.12 Dec 27 19:16:27 CLOUD qulogd[12859]: conn log: Users: OSP\roberto.lotttini, Source IP: 192.168.0.90, Computer name: 192.168.0.90, Connection type: Samba, Accessed resources: SIO/Net/NET.xlsm, Action: Read"
When doing so, you should see on your archives.json file something like the following:
{"timestamp":"2021-12-28T14:12:10.795+0000","rule":{"level":15,"description":"Evento su QNAP - CLOUD","id":"100051","firedtimes":1,"mail":true,"groups":["syslog","qnap"]},"agent":{"id":"000","name":"200-100-c7-manager"},"manager":{"name":"200-100-c7-manager"},"id":"1640700730.11967","full_log":"2021 Dec 27 18:16:30 CLOUD->192.168.0.12 Dec 27 19:16:27 CLOUD qulogd[12859]: conn log: Users: OSP\\roberto.lotttini, Source IP: 192.168.0.90, Computer name: 192.168.0.90, Connection type: Samba, Accessed resources: SIO/Net/NET.xlsm, Action: Read","predecoder":{"timestamp":"2021 Dec 27 18:16:30"},"decoder":{"name":"qnap"},"data":{"loginname":"OSP\\roberto.lotttini","sourceip":"192.168.0.90","sharename":"SIO"},"location":"192.168.200.1"}
Then, in my case, I can see on the alerts.json file the same entry:
{"timestamp":"2021-12-28T14:12:10.795+0000","rule":{"level":15,"description":"Evento su QNAP - CLOUD","id":"100051","firedtimes":1,"mail":true,"groups":["syslog","qnap"]},"agent":{"id":"000","name":"200-100-c7-manager"},"manager":{"name":"200-100-c7-manager"},"id":"1640700730.11967","full_log":"2021 Dec 27 18:16:30 CLOUD->192.168.0.12 Dec 27 19:16:27 CLOUD qulogd[12859]: conn log: Users: OSP\\roberto.lotttini, Source IP: 192.168.0.90, Computer name: 192.168.0.90, Connection type: Samba, Accessed resources: SIO/Net/NET.xlsm, Action: Read","predecoder":{"timestamp":"2021 Dec 27 18:16:30"},"decoder":{"name":"qnap"},"data":{"loginname":"OSP\\roberto.lotttini","sourceip":"192.168.0.90","sharename":"SIO"},"location":"192.168.200.1"}
Hi Roberto!
I was able to verify that the decoder is not well constructed. Given the following log, what fields do you want to extract and what do you expect the final value of each to be?:
Dec 28 15:53:17 CLOUD qulogd[12859]: conn log: Users: ASP\giu.cardone, Source IP: 172.16.235.100, Computer name: 172.16.235.100, Connection type: Samba, Accessed resources: USCOVDA/CARD/TAMP.xls, Action: Read
Are there any other cases?
Hi Roberto,
You can just simply decode the log by using as a starting point the log’s program_name parameter. As the log is pre-decoded, given its well-known format, and such field is automatically extracted (with no need for custom decoding).
So, instead of the decoders you have created, please try the following one:
<decoder name="qnap">
<program_name>qulogd</program_name>
<regex type="pcre2">Users: (.*), Source IP: ([^,]+),.* Accessed resources: (.*),.* Action: (.*)</regex>
<order>loginname,sourceip,sharename,action</order>
</decoder>
Here you have some documentation on how to create custom rules and decoders that may help you in the future:
I hope my answer helps you!
Best Regards,
Mariano Koremblum