Advertisement
Guest User

logstash kippo filter

a guest
Aug 18th, 2014
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. filter {
  2.     if [type] == "kippo" {
  3.         mutate {
  4.             add_tag => [ "ssh" ]
  5.         }
  6.  
  7.         grok {
  8.             match => [ "message", "%{TIMESTAMP_ISO8601:logdate} \[%{DATA:service}\] %{DATA:message}$"]
  9.             overwrite => [ "message" ]
  10.         }
  11.  
  12.         date {
  13.             match => [ "logdate" , "YYYY-MM-dd HH:mm:ssZ" ]
  14.         }
  15.  
  16.         if [service] != "-" and [service] =~ /[^,]+,[^,]+,[^,]+/ {
  17.             grok {
  18.                 match => [ "service", "%{DATA:service},%{POSINT:src_port},%{IP:src_ip}"]
  19.                 overwrite => [ "service" ]
  20.             }
  21.  
  22.             if [message] =~ /login attempt \[.*\] (failed|succeeded)/ {
  23.                 mutate {
  24.                     add_tag => [ "credentials" ]
  25.                 }
  26.             }
  27.         } else {
  28.             mutate {
  29.                 drop { }
  30.             }
  31.         }
  32.     }
  33.  
  34.     if [src_ip] {
  35.         geoip {
  36.             source => src_ip
  37.         }
  38.  
  39.         geoip {
  40.             source => src_ip
  41.             database => "/opt/logstash/vendor/geoip/GeoIPASNum.dat"
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement