-
-
Save silvestrelosada/e09c0d8e7b816a58b59900f6d6e1dda5 to your computer and use it in GitHub Desktop.
Logstash - Netscaler Config
This file contains 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 => "netscaler" | |
port => "5560" | |
} | |
} | |
filter { | |
# Set tags for ASAs | |
if [host] == "192.168.174.23" { | |
mutate { | |
add_field => [ "@netscaler", "REY" ] | |
add_tag => "netscaler" | |
} | |
} | |
# 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" | |
] | |
} | |
} | |
# Setting up Citrix Netscaler parsing | |
filter { | |
if "netscaler" in [tags] { | |
grok { | |
break_on_match => true | |
match => [ | |
"message", "<%{POSINT:syslog_pri}> %{DATE_US}:%{TIME} GMT %{SYSLOGHOST:syslog_hostname} %{GREEDYDATA:netscaler_message} : %{DATA} %{IP:source_ip}:%{POSINT:source_port} - %{DATA} %{IP:vserver_ip}:%{POSINT:vserver_port} - %{DATA} %{IP:nat_ip}:%{POSINT:nat_port} - %{DATA} %{IP:destination_ip}:%{POSINT:destination_port} - %{DATA} %{DATE_US:DELINK_DATE}:%{TIME:DELINK_TIME} GMT - %{DATA} %{POSINT:total_bytes_sent} - %{DATA} %{POSINT:total_bytes_recv}", | |
"message", "<%{POSINT:syslog_pri}> %{DATE_US}:%{TIME} GMT %{SYSLOGHOST:syslog_hostname} %{GREEDYDATA:netscaler_message} : %{DATA} %{IP:source_ip}:%{POSINT:source_port} - %{DATA} %{IP:destination_ip}:%{POSINT:destination_port} - %{DATA} %{DATE_US:START_DATE}:%{TIME:START_TIME} GMT - %{DATA} %{DATE_US:END_DATE}:%{TIME:END_TIME} GMT - %{DATA} %{POSINT:total_bytes_sent} - %{DATA} %{POSINT:total_bytes_recv}", | |
"message", "<%{POSINT:syslog_pri}> %{DATE_US}:%{TIME} GMT %{SYSLOGHOST:syslog_hostname} %{GREEDYDATA:netscaler_message} : %{DATA} %{INT:netscaler_spcbid} - %{DATA} %{IP:clientip} - %{DATA} %{INT:netscaler_client_port} - %{DATA} %{IP:netscaler_vserver_ip} - %{DATA} %{INT:netscaler_vserver_port} %{GREEDYDATA:netscaler_message} - %{DATA} %{WORD:netscaler_session_type}", | |
"message", "<%{POSINT:syslog_pri}> %{DATE_US}:%{TIME} GMT %{SYSLOGHOST:syslog_hostname} %{GREEDYDATA:netscaler_message}" | |
] | |
} | |
syslog_pri { } | |
geoip { | |
database => "/etc/logstash/geoip/GeoLiteCity.dat" | |
source => "source_ip" | |
target => "geoip" | |
add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ] | |
add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}" ] | |
add_field => [ "[geoip][country_name]", "%{[geoip][country_name]}" ] | |
add_field => [ "[geoip][city_name]", "%{[geoip][city_name]}" ] | |
} | |
mutate { | |
add_field => [ "src_ip", "%{source_ip}" ] | |
convert => [ "[geoip][coordinates]", "float" ] | |
replace => [ "@source_host", "%{host}" ] | |
replace => [ "@message", "%{netscaler_message}" ] | |
} | |
} | |
} | |
output { | |
elasticsearch { | |
host => "xxx.xxxx.is" | |
cluster => "xxxxx.logging" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment