Ok, so, the problem is that you are first populating the files and then trying to collect the logs from them. The log data collection, right now, is not capable of doing so, it just collects logs that have been written after the first time the file was discovered by the agent.
Despite this, there are two workarounds to do so, that I can think of. The first would be to copy the logs to a backup file, empty the original log file, and then copy+paste the logs back to the original log file/s. You can clear the file with the agent either running or stopped, but you should fill the file with the agent running.
Another possibility (unsafe one, not so much recommended), would be to modify the file’ status while having your agent stopped. To do so, you should locate the file_status.json
file on your agent’s installation folder and set your file of interest’s offset to “0”. for example, if you have this:
{"files":[{"path":"/var/log/dpkg.log","hash":"73102ace1c9ebab8ade3a8cdbbe92f9284e4f760","offset":"127600"},{"path":"/var/ossec/logs/active-responses.log","hash":"da39a3ee5e6b4b0d3255bfef95601890afd80709","offset":"0"},{"path":"/var/log/syslog","hash":"41f0acb4bdde12e7de8afb8ab556e0b127987ee0","offset":"727"},{"path":"/var/log/auth.log","hash":"507f87a476c50c1ac1bbf02e580f9c5cb1acc883","offset":"899"},{"path":"/var/log/kern.log","hash":"bd735c59c868f39c097141ab3fb85a421d19f138","offset":"170169"},{"path":"/root/test.log","hash":"da382093a20504efbc8b9c7bf5d589d9f686080a","offset":"40"}]}
And, if you want the “/root/test.log” to be read from the beginning, you should modify its offset and set it to “0”, just as follows:
{"files":[{"path":"/var/log/dpkg.log","hash":"73102ace1c9ebab8ade3a8cdbbe92f9284e4f760","offset":"127600"},{"path":"/var/ossec/logs/active-responses.log","hash":"da39a3ee5e6b4b0d3255bfef95601890afd80709","offset":"0"},{"path":"/var/log/syslog","hash":"41f0acb4bdde12e7de8afb8ab556e0b127987ee0","offset":"727"},{"path":"/var/log/auth.log","hash":"507f87a476c50c1ac1bbf02e580f9c5cb1acc883","offset":"899"},{"path":"/var/log/kern.log","hash":"bd735c59c868f39c097141ab3fb85a421d19f138","offset":"170169"},{"path":"/root/test.log","hash":"da382093a20504efbc8b9c7bf5d589d9f686080a","offset":"0"}]}
Then restart your agent and it should now collect all the logs from the file/s.
I hope my answer helps you, please let us know!
Best Regards,
Mariano Koremblum
Cristian,
I have tested the log, that you have sent us, with our wazuh-logtest
tool (check it out here) and the result is the following:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# /var/ossec/bin/wazuh-logtest
Starting wazuh-logtest v4.4.0
Type one log per line
10.0.122.114 slatina\vexgenpres02 Android-SAMSUNG-SM-A105FN/101.11 Y 2022-02-08 13:42:33 W3ReverseProxy B-TMG1 - mail.alro.ro 10.1.220.73 443 234 435 56944 https TCP POST http://mail.alro.ro/Microsoft-Server-ActiveSync?Cmd=Sync&User=slatina%5Cvexgenpres02&DeviceId=SEC18B7504E41DC5&DeviceType=SamsungDevice application/vnd.ms-sync.wbxml Inet 200 0x40000008 Exch2010 ActiveSync Req ID: 072efcfc; Compression: client=Yes, server=No, compress rate=0% decompress rate=0% ; FBA cookie: exists=no, valid=no, updated=yes, logged off=no, client type=unknown, user activity=yes Internal Local Host 0x600 Allowed 2022-02-08 13:42:33 - Allowed - - - - - - - 0- 0 - - - - - - 0 0 - 0 - — Web Proxy mail.alro.ro 46160 -
**Phase 1: Completed pre-decoding.
full event: ‘10.0.122.114 slatina\vexgenpres02 Android-SAMSUNG-SM-A105FN/101.11 Y2022-02-08 13:42:33 W3ReverseProxy B-TMG1 - mail.alro.ro 10.1.220.73 443234 435 56944 https TCP POST http://mail.alro.ro/Microsoft-Server-ActiveSync?Cmd=Sync&User=slatina%5Cvexgenpres02&DeviceId=SEC18B7504E41DC5&DeviceType=SamsungDevice application/vnd.ms-sync.wbxml Inet 200 0x40000008 Exch2010 ActiveSync Req ID: 072efcfc; Compression: client=Yes, server=No, compress rate=0% decompress rate=0% ; FBA cookie: exists=no, valid=no, updated=yes, logged off=no, client type=unknown, user activity=yes Internal Local Host 0x600 Allowed 2022-02-08 13:42:33 - Allowed - - - - - - -0 - 0 - - - - - - 0 0 - 0 — - Web Proxy mail.alro.ro 46160 -‘
**Phase 2: Completed decoding.
name: ‘cylance_threats’
cylance_threats.av_industry: ‘56944’
cylance_threats.cylance_score: ‘234’
cylance_threats.file_name: ‘10.0.122.114 slatina\vexgenpres02 Android-SAMSUNG-SM-A105FN/101.11 Y 2022-02-08 13:42:33 W3ReverseProxy B-TMG1 - mail.alro.ro10.1.220.73’
cylance_threats.file_status: ‘443’
cylance_threats.global_quarantined: ‘https’
cylance_threats.safelisted: ‘TCP’
cylance_threats.signature_status: ‘435’
cylance_threats.signed: ‘POST’
**Phase 3: Completed filtering (rules).
id: ‘87050’
level: ‘0’
description: ‘Cylance threats messages grouped.’
groups: ‘[‘cylance’]’
firedtimes: ‘1’
mail: ‘False’
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This shows that your event is not producing any alert (level: ‘0’). Any event that matches a rule should be above the log_alert_level,
set in the manager’s ossec.conf
file, in order to trigger an alert and so it is then displayed on Kibana.
You can still configure Kibana to collect all the logs from the archives.json
file, even though they do not trigger any alert. Please, let us know if that is what you are looking for.
Best Regards,
Mariano Koremblum
Well, in this case, we know that this particular log, that we have used for testing, is matching against rule 87050. So you could create a child rule to match with it given some pattern or just set a higher alert level for every event that passes through.
If you want to match every event of this kind, you could simply add the following to your manager’s /var/ossec/etc/rules/local_rules.xml
file:
<rule id="187051" level="3">
<if_sid>87050</if_sid>
<description>Cylance event.</description>
</rule>
If you want to do a more complex rule matching, I would strongly recommend you to read the following links:
I think this is the best option because is more restrictive and it won’t flood your Kibana dashboard as if you were ingesting all the logs. If you still want to ingest every single log located on the archives.json
file, please let us know.
Best Regards,
Mariano Koremblum
--
You received this message because you are subscribed to a topic in the Google Groups "Wazuh mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wazuh/_07O5e08Yz4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wazuh+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/a102577b-6236-4fc1-b44f-51044e272b40n%40googlegroups.com.