Hello Dave,
It’s possible that logs you want to see in Kibana don’t match any rule and don’t generate alerts. You can create new rules and decoders for it using our documentation.
To check that I’m right you can use ossec-logtest. Logtest is a tool for testing and verification of rules and decoders.
An example of ossec-logtest output is the following:
2019/10/08 16:38:45 ossec-testrule: INFO: Started (pid: 9807).
ossec-testrule: Type one log per line.
[Sat Oct 05 11:27:59 2019] [warn] [client 192.168.########] PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /var/www/html/XXXXXXXX
**Phase 1: Completed pre-decoding.
full event: '[Sat Oct 05 11:27:59 2019] [warn] [client 192.168.########] PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /var/www/html/XXXXXXXX'
timestamp: 'Sat Oct 05 11:27:59 2019'
hostname: 'lopezziur'
program_name: '(null)'
log: '[warn] [client 192.168.########] PHP Warning: imagedestroy() expects parameter 1 to be resource, null given in /var/www/html/XXXXXXXX'
**Phase 2: Completed decoding.
decoder: 'apache-errorlog'
srcip: '192.168.########'
**Phase 3: Completed filtering (rules).
Rule id: '30102'
Level: '0'
Description: 'Apache warn messages grouped.'
I have input the log you sent and the output was this.
Note the log processing consist of three phases.
Respect MySQL alerts you can test these rules. To do it:
ruleset/decoders/0025-apache_decoders.xml and ruleset/decoders/0150-mysql_decoders.xml files.custom-decoders.xml in etc/decoders/local_decoders.xmlruleset/rules to replacing to default rules.These rules seem works:
root@lopezziur:/var/ossec# bin/ossec-logtest
2019/10/08 16:59:31 ossec-testrule: INFO: Started (pid: 10113).
ossec-testrule: Type one log per line.
2019-10-03T22:25:49.537480Z 20281929 [Note] Access denied for user 'root'@'localhost' (using password: YES)
**Phase 1: Completed pre-decoding.
full event: '2019-10-03T22:25:49.537480Z 20281929 [Note] Access denied for user 'root'@'localhost' (using password: YES)'
timestamp: '2019-10-03T22:25:49.537480Z 202'
hostname: '1929'
program_name: '(null)'
log: '[Note] Access denied for user 'root'@'localhost' (using password: YES)'
**Phase 2: Completed decoding.
decoder: 'custom-decoder'
**Phase 3: Completed filtering (rules).
Rule id: '50106'
Level: '9'
Description: 'MySQL: authentication failure.'
**Alert to be generated.
To monitor MySQL file you can use Syslog log format:
<localfile>
<log_format>syslog</log_format>
<location>/var/log/mysqld.log</location>
</localfile>
I hope it helps you. If you have further questions let us know.
Best regards,
Eva
Hi Dave,
Sorry, I forgot to mention if you update ruleset you lose the custom rules and decoders. After you update it, you should replace again the custom files.
The fact you save these files in ruleset and not in etc/rule is due we are modifying exists rules. Save it in etc/rules may cause problems.
New rules can be added etc/rules. If you need help to create a rule or decoder you send us the log you match it and we will help you.
Best regards,
Eva