Guest User

Untitled

a guest
Jan 4th, 2018
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. input {
  2. file {
  3. type => "app"
  4. path => "/var/log/app.log"
  5. codec => multiline {
  6. pattern => "^%{TIMESTAMP_ISO8601}.*"
  7. negate => "true"
  8. what => "previous"
  9. }
  10. }
  11. }
  12.  
  13. filter {
  14. #If log line contains tab character followed by 'at' then we will tag that entry as stacktrace
  15. if [message] =~ "\tat" {
  16. grok {
  17. match => ["message", "^(\tat)"]
  18. add_tag => ["stacktrace"]
  19. }
  20. }
  21.  
  22. #Grokking Spring Boot's default log format
  23. grok {
  24. match => ["message", "^%{TIMESTAMP_ISO8601:timestamp}%{SPACE}%{LOGLEVEL:loglevel}%{SPACE}%{NUMBER:pid}%{SPACE}---%{SPACE}%{SYSLOG5424SD:threadname}%{SPACE}(?<class>(?:[\.]?[a-zA-Z0-9-]+\.)*[A-Za-z0-9$]+)%{SPACE}:%{SPACE}%{GREEDYDATA:logmessage}$"]
  25. }
  26.  
  27. if "stacktrace" not in [tags] and [loglevel] != "ERROR" {
  28. drop {}
  29. }
  30.  
  31. #Parsing out timestamps which are in timestamp field thanks to previous grok section
  32. date {
  33. match => [ "timestamp" , "yyyy-MM-dd HH:mm:ss.SSS" ]
  34. }
  35. }
  36.  
  37. output {
  38. email {
  39. username => "noreply@domain.com"
  40. password => "noreply-user"
  41. address => "domain.com"
  42. port => 587
  43. to => "your-failure-inbox@mail.com"
  44. from => "noreply@domain.com"
  45. subject => "%{type} reported exception !"
  46. body => "%{message}"
  47. }
  48. }
Add Comment
Please, Sign In to add comment