Skip to content

Instantly share code, notes, and snippets.

@leonlaser
Last active October 3, 2022 22:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonlaser/798b3ae68efce94a0893438cacd5d1ab to your computer and use it in GitHub Desktop.
Save leonlaser/798b3ae68efce94a0893438cacd5d1ab to your computer and use it in GitHub Desktop.
[logfmt regex] Split your logfmt logfile into key value pairs #golang #go #regex #regularexpression #logfmt #intellij #ideolog
Message pattern: ^time="(.*)" level=([^\s]+) .*$
Message start pattern: ^time=
Time format: yyyy-MM-dd'T'HH:mm:ssXXX
Time capture group: 1
Serverity capture group: 2
Reference: https://github.com/JetBrains/ideolog/wiki/Custom-Log-Formats
([a-z]+)=(?:(?:"(.*)")|(?:(?:([^\s]+)[\s])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment