Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5 from theflakes/master
Browse files Browse the repository at this point in the history
Add source of syslog as destination IP for Sguil alert
  • Loading branch information
dougburks committed Jul 3, 2015
2 parents 95ddef0 + 4ca4a0c commit 977b883
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions etc/nsm/ossec/ossec_agent.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ proc ProcessData { line } {
} elseif { ([regexp {(?x)
# ^(\d\d\d\d)\s+(...)\s+(\d\d)\s+(\d\d:\d\d:\d\d)\s+(.*)->
# ^(\d\d\d\d)\s+(...)\s+(\d\d)\s+(\d\d:\d\d:\d\d)\s+(\(.*\)\s+)*(.*)->
^(\d\d\d\d)\s+(...)\s+(\d\d)\s+(\d\d:\d\d:\d\d)\s+(\(.*\)\s+)*(\S+)->
} $line MatchVar year month day time placeholder agent]) } {
^(\d\d\d\d)\s+(...)\s+(\d\d)\s+(\d\d:\d\d:\d\d)\s+(\(.*\)\s+)*(\S+)->(\d+.\d+.\d+.\d+)*
} $line MatchVar year month day time placeholder agent syslog_source]) } {
set nDate [clock format [clock scan "$day $month $year $time" ] -gmt true -f "%Y-%m-%d %T"]
# Ok, this is confusing, but the regexp can return either one
# or two variables, depending on the format of the input line.
Expand All @@ -222,7 +222,13 @@ proc ProcessData { line } {
# usually just be one field (either a hostname or an IP address,
# depending on the log source). In either case, the $agent
# variable ends up holding the correct value for our purposes.
set agent [ResolveHostname $agent]
# SyslogSource will pull out the IP of the device sending a
# syslog to OSSEC.
if {[string length $syslog_source] != 0} {
set agent $syslog_source
} else {
set agent [ResolveHostname $agent]
}
} elseif { [regexp {(?x)
^Rule:\s+(\d+)\s+\(level\s+(\d+)\)\s+->\s+'(.*)'
} $line MatchVar sig_id priority message ] } {
Expand Down

0 comments on commit 977b883

Please sign in to comment.