Created
December 3, 2014 17:15
-
-
Save haukurk/b049f3de2669a39659c1 to your computer and use it in GitHub Desktop.
Logstash - Cisco ASA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
syslog { | |
type => "cisco-asa" | |
port => "5561" | |
} | |
} | |
filter { | |
# Set tags for ASAs | |
if [host] == "xxx.xxx.xxx.xxx" { | |
mutate { | |
add_field => [ "@site", "REY" ] | |
add_field => [ "@country", "IS" ] | |
add_tag => "ASA" | |
add_tag => "cisco-fw" | |
} | |
} | |
if [host] == "xxx.xxx.xxx.xxx" { | |
mutate { | |
add_field => [ "@site", "RTM" ] | |
add_field => [ "@country", "NL" ] | |
add_tag => "ASA" | |
} | |
} | |
} | |
filter { | |
####### Cisco FW #### | |
if [type] == "cisco-asa" { | |
grok { | |
match => ["message", "%{CISCO_TAGGED_SYSLOG} %{GREEDYDATA:cisco_message}"] | |
} | |
# Parse the syslog severity and facility | |
syslog_pri { } | |
# Extract fields from the each of the detailed message types | |
# The patterns provided below are included in core of LogStash 1.2.0. | |
grok { | |
match => [ | |
"cisco_message", "%{CISCOFW106001}", | |
"cisco_message", "%{CISCOFW106006_106007_106010}", | |
"cisco_message", "%{CISCOFW106014}", | |
"cisco_message", "%{CISCOFW106015}", | |
"cisco_message", "%{CISCOFW106021}", | |
"cisco_message", "%{CISCOFW106023}", | |
"cisco_message", "%{CISCOFW106100}", | |
"cisco_message", "%{CISCOFW110002}", | |
"cisco_message", "%{CISCOFW302010}", | |
"cisco_message", "%{CISCOFW302013_302014_302015_302016}", | |
"cisco_message", "%{CISCOFW302020_302021}", | |
"cisco_message", "%{CISCOFW305011}", | |
"cisco_message", "%{CISCOFW313001_313004_313008}", | |
"cisco_message", "%{CISCOFW313005}", | |
"cisco_message", "%{CISCOFW402117}", | |
"cisco_message", "%{CISCOFW402119}", | |
"cisco_message", "%{CISCOFW419001}", | |
"cisco_message", "%{CISCOFW419002}", | |
"cisco_message", "%{CISCOFW500004}", | |
"cisco_message", "%{CISCOFW602303_602304}", | |
"cisco_message", "%{CISCOFW710001_710002_710003_710005_710006}", | |
"cisco_message", "%{CISCOFW713172}", | |
"cisco_message", "%{CISCOFW733100}" | |
] | |
} | |
geoip { | |
add_tag => [ "GeoIP" ] | |
database => "/etc/logstash/geoip/GeoLiteCity.dat" | |
source => "src_ip" | |
} | |
if [geoip][city_name] == "" { mutate { remove_field => "[geoip][city_name]" } } | |
if [geoip][continent_code] == "" { mutate { remove_field => "[geoip][continent_code]" } } | |
if [geoip][country_code2] == "" { mutate { remove_field => "[geoip][country_code2]" } } | |
if [geoip][country_code3] == "" { mutate { remove_field => "[geoip][country_code3]" } } | |
if [geoip][country_name] == "" { mutate { remove_field => "[geoip][country_name]" } } | |
if [geoip][latitude] == "" { mutate { remove_field => "[geoip][latitude]" } } | |
if [geoip][longitude] == "" { mutate { remove_field => "[geoip][longitude]" } } | |
if [geoip][postal_code] == "" { mutate { remove_field => "[geoip][postal_code]" } } | |
if [geoip][region_name] == "" { mutate { remove_field => "[geoip][region_name]" } } | |
if [geoip][time_zone] == "" { mutate { remove_field => "[geoip][time_zone]" } } | |
# Parse the date | |
date { | |
match => ["timestamp", | |
"MMM dd HH:mm:ss", | |
"MMM d HH:mm:ss", | |
"MMM dd yyyy HH:mm:ss", | |
"MMM d yyyy HH:mm:ss" | |
] | |
} | |
} | |
###### End of Cisco FW ####### | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment