Skip to content

Instantly share code, notes, and snippets.

@haukurk
Created December 3, 2014 17:13
Show Gist options
  • Save haukurk/95a7dad58ff475fbb987 to your computer and use it in GitHub Desktop.
Save haukurk/95a7dad58ff475fbb987 to your computer and use it in GitHub Desktop.
Logstash - Netscaler Config
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"
}
}
@orhplt
Copy link

orhplt commented Jul 20, 2018

i want to get citrix log for elasticsearch but i did'not find any method. Normally i use filebeat, but it doest work citrix.
can you help me how i can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment