Skip to content

Instantly share code, notes, and snippets.

@muresan
Created February 18, 2021 00:24
Show Gist options
  • Save muresan/c59f3ecfb803606d4ea8489f29f728a6 to your computer and use it in GitHub Desktop.
Save muresan/c59f3ecfb803606d4ea8489f29f728a6 to your computer and use it in GitHub Desktop.
regexp log parsing
{job="varlogs",filename="/var/log/secure"}
| regexp "(?P<month>\\w+) (?P<day>\\d+) (?P<time>\\d{2}:\\d{2}:\\d{2}) (?P<hostname>\\w+) (?P<process>\\w+)\\[(?P<pid>\\d+)\\]: (?P<message>.*)"
{job="varlogs",filename="/var/log/messages"}
| regexp "(?P<month>\\w+) (?P<day>\\d+) (?P<time>\\d{2}:\\d{2}:\\d{2}) (?P<hostname>\\w+) (?P<process>\\w+)(\\[(?P<pid>\\d+)\\])?: (?P<message>.*)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment