grok-patterns 5.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. DATETIME \[\d.*\d]
  2. HTTPNAME \b(?:[0-9A-Za-z_\-][0-9A-Za-z-_\-]{0,62})(?:\.(?:[0-9A-Za-z_\-][0-9A-Za-z-:\-_]{0,62}))*(\.?|\b)
  3. USERNAME [a-zA-Z0-9._-]+
  4. USER %{USERNAME}
  5. EMAILLOCALPART [a-zA-Z][a-zA-Z0-9_.+-=:]+
  6. EMAILADDRESS %{EMAILLOCALPART}@%{HOSTNAME}
  7. INT (?:[+-]?(?:[0-9]+))
  8. BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
  9. NUMBER (?:%{BASE10NUM})
  10. BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
  11. BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
  12. POSINT \b(?:[1-9][0-9]*)\b
  13. NONNEGINT \b(?:[0-9]+)\b
  14. WORD \b\w+\b
  15. NOTSPACE \S+
  16. SPACE \s*
  17. DATA .*?
  18. GREEDYDATA .*
  19. QUOTEDSTRING (?>(?<!\\)(?>"(?>\\.|[^\\"]+)+"|""|(?>'(?>\\.|[^\\']+)+')|''|(?>`(?>\\.|[^\\`]+)+`)|``))
  20. UUID [A-Fa-f0-9]{8}-(?:[A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}
  21. # URN, allowing use of RFC 2141 section 2.3 reserved characters
  22. URN urn:[0-9A-Za-z][0-9A-Za-z-]{0,31}:(?:%[0-9a-fA-F]{2}|[0-9A-Za-z()+,.:=@;$_!*'/?#-])+
  23. # Networking
  24. MAC (?:%{CISCOMAC}|%{WINDOWSMAC}|%{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\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?
  29. IPV4 (?<![0-9])(?:(?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]))(?![0-9])
  30. IP (?:%{IPV6}|%{IPV4})
  31. HOSTNAME \b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\.?|\b)
  32. IPORHOST (?:%{IP}|%{HOSTNAME})
  33. HOSTPORT %{IPORHOST}:%{POSINT}
  34. # paths
  35. PATH (?:%{UNIXPATH}|%{WINPATH})
  36. UNIXPATH (/([\w_%!$@:.,+~-]+|\\.)*)+
  37. TTY (?:/dev/(pts|tty([pq])?)(\w+)?/?(?:[0-9]+))
  38. WINPATH (?>[A-Za-z]+:|\\)(?:\\[^\\?*]*)+
  39. URIPROTO [A-Za-z]([A-Za-z0-9+\-.]+)+
  40. URIHOST %{IPORHOST}(?::%{POSINT:port})?
  41. # uripath comes loosely from RFC1738, but mostly from what Firefox
  42. # doesn't turn into %XX
  43. URIPATH (?:/[A-Za-z0-9$.+!*'(){},~:;=@#%&_\-]*)+
  44. #URIPARAM \?(?:[A-Za-z0-9]+(?:=(?:[^&]*))?(?:&(?:[A-Za-z0-9]+(?:=(?:[^&]*))?)?)*)?
  45. URIPARAM \?[A-Za-z0-9$.+!*'|(){},~@#%&/=:;_?\-\[\]<>]*
  46. URIPATHPARAM %{URIPATH}(?:%{URIPARAM})?
  47. URI %{URIPROTO}://(?:%{USER}(?::[^@]*)?@)?(?:%{URIHOST})?(?:%{URIPATHPARAM})?
  48. # Months: January, Feb, 3, 03, 12, December
  49. MONTH \b(?:[Jj]an(?:uary|uar)?|[Ff]eb(?:ruary|ruar)?|[Mm](?:a|ä)?r(?:ch|z)?|[Aa]pr(?:il)?|[Mm]a(?:y|i)?|[Jj]un(?:e|i)?|[Jj]ul(?:y)?|[Aa]ug(?:ust)?|[Ss]ep(?:tember)?|[Oo](?:c|k)?t(?:ober)?|[Nn]ov(?:ember)?|[Dd]e(?:c|z)(?:ember)?)\b
  50. MONTHNUM (?:0?[1-9]|1[0-2])
  51. MONTHNUM2 (?:0[1-9]|1[0-2])
  52. MONTHDAY (?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9])
  53. # Days: Monday, Tue, Thu, etc...
  54. DAY (?:Mon(?:day)?|Tue(?:sday)?|Wed(?:nesday)?|Thu(?:rsday)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?)
  55. # Years?
  56. YEAR (?>\d\d){1,2}
  57. HOUR (?:2[0123]|[01]?[0-9])
  58. MINUTE (?:[0-5][0-9])
  59. # '60' is a leap second in most time standards and thus is valid.
  60. SECOND (?:(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?)
  61. TIME (?!<[0-9])%{HOUR}:%{MINUTE}(?::%{SECOND})(?![0-9])
  62. # datestamp is YYYY/MM/DD-HH:MM:SS.UUUU (or something like it)
  63. DATE_US %{MONTHNUM}[/-]%{MONTHDAY}[/-]%{YEAR}
  64. DATE_EU %{MONTHDAY}[./-]%{MONTHNUM}[./-]%{YEAR}
  65. ISO8601_TIMEZONE (?:Z|[+-]%{HOUR}(?::?%{MINUTE}))
  66. ISO8601_SECOND (?:%{SECOND}|60)
  67. TIMESTAMP_ISO8601 %{YEAR}-%{MONTHNUM}-%{MONTHDAY}[T ]%{HOUR}:?%{MINUTE}(?::?%{SECOND})?%{ISO8601_TIMEZONE}?
  68. DATE %{DATE_US}|%{DATE_EU}
  69. DATESTAMP %{DATE}[- ]%{TIME}
  70. TZ (?:[APMCE][SD]T|UTC)
  71. DATESTAMP_RFC822 %{DAY} %{MONTH} %{MONTHDAY} %{YEAR} %{TIME} %{TZ}
  72. DATESTAMP_RFC2822 %{DAY}, %{MONTHDAY} %{MONTH} %{YEAR} %{TIME} %{ISO8601_TIMEZONE}
  73. DATESTAMP_OTHER %{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{TZ} %{YEAR}
  74. DATESTAMP_EVENTLOG %{YEAR}%{MONTHNUM2}%{MONTHDAY}%{HOUR}%{MINUTE}%{SECOND}
  75. # Syslog Dates: Month Day HH:MM:SS
  76. SYSLOGTIMESTAMP %{MONTH} +%{MONTHDAY} %{TIME}
  77. PROG [\x21-\x5a\x5c\x5e-\x7e]+
  78. SYSLOGPROG %{PROG:program}(?:\[%{POSINT:pid}\])?
  79. SYSLOGHOST %{IPORHOST}
  80. SYSLOGFACILITY <%{NONNEGINT:facility}.%{NONNEGINT:priority}>
  81. HTTPDATE %{MONTHDAY}/%{MONTH}/%{YEAR}:%{TIME} %{INT}
  82. # Shortcuts
  83. QS %{QUOTEDSTRING}
  84. # Log formats
  85. SYSLOGBASE %{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}:
  86. # Log Levels
  87. LOGLEVEL ([Aa]lert|ALERT|[Tt]race|TRACE|[Dd]ebug|DEBUG|[Nn]otice|NOTICE|[Ii]nfo|INFO|[Ww]arn?(?:ing)?|WARN?(?:ING)?|[Ee]rr?(?:or)?|ERR?(?:OR)?|[Cc]rit?(?:ical)?|CRIT?(?:ICAL)?|[Ff]atal|FATAL|[Ss]evere|SEVERE|EMERG(?:ENCY)?|[Ee]merg(?:ency)?)