View difference between Paste ID: idXvYyQD and dYu2rvi4
SHOW: | | - or go back to the newest paste.
1
filter {
2
  if [type] == "syslog" {
3
4
    #change to pfSense ip address
5
    if [host] =~ /192\.168\.3\.254/ {
6
      mutate {
7
        add_tag => ["PFSense", "Ready"]
8
      }
9
    }
10
11
    if "Ready" not in [tags] {
12
      mutate {
13
        add_tag => [ "syslog" ]
14
      }
15
    }
16
  }
17
}
18
19
filter {
20
  if [type] == "syslog" {
21
    mutate {
22
      remove_tag => "Ready"
23
    }
24
  }
25
}
26
27
filter {
28
  if "syslog" in [tags] {
29
    grok {
30
      match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
31
      add_field => [ "received_at", "%{@timestamp}" ]
32
      add_field => [ "received_from", "%{host}" ]
33
    }
34
    syslog_pri { }
35
    date {
36
      match => [ "syslog_timestamp", "MMM  d HH:mm:ss", "MMM  dd HH:mm:ss" ]
37
      locale => "en"
38
    }
39
40
    if !("_grokparsefailure" in [tags]) {
41
      mutate {
42
        replace => [ "@source_host", "%{syslog_hostname}" ]
43
        replace => [ "@message", "%{syslog_message}" ]
44
      }
45
    }
46
47
    mutate {
48
      remove_field => [ "syslog_hostname", "syslog_message", "syslog_timestamp" ]
49
    }
50
    if "_grokparsefailure" in [tags] {
51
      drop { }
52
    }
53
  }
54
}