Add Filter / Field
Posted: Thu Apr 21, 2016 8:13 am
Hey guys, newbie here. I am trying to make a filter and a field in Nagios using Grok. I have the data coming in from Bit9 into Nagios, but I am having no luck parsing it. This is what my Bit9 alert looks like in the "message" section:
I have the following Grok pattern that parses through the message:
It works when I test it on this website: http://grokconstructor.appspot.com/do/match
and it does what I need it to do, but in Nagios, it doesn't output like I want it to. I added the following code into a filter:
But it doesn't add the field "warning" like I told it to do, and it doesn't break the message field down like it does in the online tester website. Any ideas? Thanks!
Code: Select all
<14>Apr 20 13:34:39 **BIT9SERVER** Bit9 event: text="File 'c:\d88f3abb57d62b99a0\setuputility.exe' [ffebe9c434fc6f4d7e8760d3b68f4c0a2dab822c643a0dedee92b83e282704f0] was approved by Publisher 'Microsoft Corporation'." type="Policy Enforcement" subtype="File approved (publisher)" hostname="**Example Hostname**" username="NT AUTHORITY\SYSTEM" date="4/20/2016 1:34:32 PM" ip_address="**IP ADDRESS**" process="c:\windows\softwaredistribution\download\install\ndp46-kb3136000-x64.exe" file_path="c:\d88f3abb57d62b99a0\setuputility.exe" file_name="setuputility.exe" file_hash="ffebe9c434fc6f4d7e8760d3b68f4c0a2dab822c643a0dedee92b83e282704f0" installer_name="bite3fe.tmp" policy="High" rule_name="Approve writes from trusted processes" process_key="0000034d-0000-1a90-01d1-9b095da2eb34" server_version="7.2.1.1562" file_trust="10" file_threat="0" process_trust="10" process_threat="0"Code: Select all
text=%{QS:warning} type=%{QS:type} subtype=%{QS:subtype} hostname=%{QS:hostname} username=%{QS:user} date=%{QS:date} ip_address=%{QS:client_ip} process=%{QS:process} file_path=%{QS:path} file_name=%{QS:file} file_hash=%{QS:hash} installer_name=%{QS:installer_exe} policy=%{QS:policy} rule_name=%{QS:rule_name} process_key=%{QS:proc_key} server_version=%{QS:server_ver} file_trust=%{QS:f_trust} file_threat=%{QS:f_threat} process_trust=%{QS:p_trust} process_threat=%{QS:p_threat}
and it does what I need it to do, but in Nagios, it doesn't output like I want it to. I added the following code into a filter:
Code: Select all
if [type] == "syslog" {
grok {
match => [ "message", "text=%{QS:warning} type=%{QS:type} subtype=%{QS:subtype} hostname=%{QS:hostname} username=%{QS:user} date=%{QS:date} ip_address=%{QS:client_ip} process=%{QS:process} file_path=%{QS:path} file_name=%{QS:file} file_hash=%{QS:hash} installer_name=%{QS:installer_exe} policy=%{QS:policy} rule_name=%{QS:rule_name} process_key=%{QS:proc_key} server_version=%{QS:server_ver} file_trust=%{QS:f_trust} file_threat=%{QS:f_threat} process_trust=%{QS:p_trust} process_threat=%{QS:p_threat}" ]
add_field => [ "warning", "test!" ]
}
}