Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. filter {
  2.  
  3. # Pull out the Syslog Priority
  4.  
  5. grok {
  6. named_captures_only => true
  7. match => { "message" => "<%{INT:syslog_pri}>" }
  8. }
  9.  
  10. # Convert the syslog priority to human readable format
  11. syslog_pri { }
  12.  
  13. # Check for syslog headers
  14. grok {
  15. match => { "message" => "%{SYSLOGTIMESTAMP} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:source_host} %{SYSLOGPROG}" }
  16. add_tag => "syslogbase"
  17. }
  18.  
  19. # If syslog headers are present, move the syslog message into a new field named syslog_message(to capture the original)
  20. # Rename the host field to host_ip to retain the host ip address
  21. # Replace the host field with the hostname acquired from %SYSLOGHOST
  22. # Remove the source_host field for the sake of brevity
  23. if ("syslogbase" in [tags]) {
  24. mutate {
  25. rename => ["message", "syslog_message"]
  26. rename => ["host", "host_ip"]
  27. rename => ["source_host", "host"]
  28. }
  29.  
  30. # Apply the SYSLOG GROK to the message to parse out the syslog headers, then place the left overs
  31. # in message where we expect it to be.
  32. grok {
  33. match => ["syslog_message", "%{SYSLOGTIMESTAMP} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST} %{PROG}(?:\[%{POSINT}\])?\S+ %{GREEDYDATA:message}"]
  34. add_tag => "sysloggrok"
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement