I use Promtail Loki to collect my logs.
Input logs are JSON strings that look like this:
{ "severity":"error", "msg":"very bad error", "duration":20 }
How can I parse this string by Promtail to get duration as numeric in Loki?
My goal is to be able to make queries like this:
{job="job_name"}|duration>10s
CodePudding user response:
The following PromQL should work:
{job="job_name"} | json | duration>10
You can't use values like "10s", but you can use "10K" or "10M" ones.