Skip to content

Instantly share code, notes, and snippets.

@ryaminal
Created May 15, 2019 01:33
Show Gist options
  • Save ryaminal/70d308f6efbeefb9f219406044ee5458 to your computer and use it in GitHub Desktop.
Save ryaminal/70d308f6efbeefb9f219406044ee5458 to your computer and use it in GitHub Desktop.
parser-rewrite-noformat
{
lineGroupers: [
{
start: "^\\d{4}-\\d{2}-\\d+ \\d{2}:\\d{2}:\\d{2},\\d+",
haltBefore: "^\\d{4}-\\d{2}-\\d+ \\d{2}:\\d{2}:\\d{2},\\d+"
}
],
patterns: {
axTs: "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{9}",
axTz: "[\\-\\+]\\d{2}:\\d{2}",
axTsTz: "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{9}[\\-\\+]\\d{2}:\\d{2}"
ymdnum: "\\d+-\\d+-\\d+\\s+[0-9:]+,[0-9]{3}",
},
formats: [
{
format: ".*logType=Systemd.*\"MESSAGE\":\"$severity$ $_=axTsTz$ \\[$thread$\\|$line$\\] $_$",
halt: false,
},
{
id: "log-message-with-id",
format: "$logTS=ymdnum$ - ${parse=commaKeyValues}$ $msg{parse=json}$",
halt: false,
rewrites: [
{
input: "msgMESSAGE",
output: "z_ignoreMESSAGE",
match: "^!!!",
replace: "!!!"
}, {
input: "msgMessage",
output: "z_ignoreM_essage",
match: "^!!!",
replace: "!!!"
}, {
input: "msgDate",
output: "timestamp",
match: ".*",
replace: "$0"
}
]
}, {
format: ".*logType=Systemd.*",
halt: true,
rewrites: [
{
input: "z_ignoreMESSAGE",
output: ".",
match: "^!!!$",
replace: "$0"
},
{
input: "z_ignoreMESSAGE",
output: ".",
match: ".*\"MESSAGE\":.*",
replace: "thing"
}
]
}, {
format: ".*\"message\":.*",
halt: true,
rewrites: [
{
input: "z_ignoreM_essage",
output: ".",
match: "^!!!$",
replace: "$0"
}
]
}, {
id: "log-fallthrough",
format: "$msg$"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment