Skip to main content

Logflare Query Language (LQL)

The Logflare Query Language (LQL) is used within Logflare to power filtering capabilities for historical search and realtime streams.

The quick reference for LQL can be accessed within the dashboard through the LQL button at the source navigation bar.

LQL Quick Reference

Event Message Filtering

Any string not matching a supported operator will search against the log event message. Some strings may need to be wrapped in double quotes. By default, all LQL statements are case sensitive.

FieldFilterSyntaxExample
Messagematch exact stringworderror
Messagematch exact string with spacesdouble quoted string"staging error"
Messagematch, regexregex string~server\_\d
Messagematch regex with spacesdouble quoted regex string~"log message \d\d"
Messagematch regex, case insensitiveregex string with (?i) prefix~(?i)server\_\d
~"(?i)log message \d\d"
Messagematch regex with double quotesregex string with symbol~some\"value
~"msg with \" spaces"
Messagematch regex, with ORregex string with symbol~"jpg$|jpeg$|png$"

Metadata Filtering

You can use data in metadata fields to limit your search. Reference your schema for supported fields.

FieldFilterSyntaxExample
Metadataexact matchpath:valuem.response.status_code:500
Metadatamatch float, integer or datetime valuespath:>=value
path:>value
path:<=value
path:<value
m.response.status_code:>300
m.response.status_code:<=400
m.user.created_at:>2019-07-01T00:15:00
Metadatamatch regexpath:~regexm.browser:~"Firefox 5\d"
Metadatamatch regex orpath:~"value1|value2|value3"m.url:~"jpg$|jpeg$|png$"
Metadatamatch array includespath:@>valuem.user.roles:@>"new" subscriber"
Metadatamatch array includes regexpath:@>~valuem.user.roles:@>~new
m.user.roles:@>~"new subscriber"
Metadatamatch does NOT include-path:value-m.user.company:"My Company"
Metadatamatch booleanpath:true
path:false
m.door_open:true
Metadatamatch NULLpath:NULLm.user.plan:NULL

Timestamp Filtering

Timestamps are not available when live search is active.

Timestamps will be automatically converted to UTC if Logflare is set to display local time.

FieldFilterExample
Timestamptoday, yesterdayt:today
t:yesterday
Timestamplast X time periodst:last@100hours
t:last@7days
t:last@30minutes
Timestampthis calendar time periodt:this@week
t:this@day
t:this@month
Timestampdate ranget:2022-04-{07..09}
Timestampdatetime ranget:2022-04-{07..09}T00:{00..40}:00
Timestampdatetime range with subsecondst:2022-04-{07..09}T00:{00..40}:00.{001..314}

Chart Aggregations

Chart aggregations rules will display the aggregated trends in the chart. Chart rules use the special prefix c

FieldAggregationExample
ccountc:count(*)
cavgc:avg(m.latency)
csumc:sum(m.latency)
cmaxc:max(m.latency)
cp50c:p50(m.latency)
cp95c:p95(m.latency)
cp99c:p99(m.latency)

Beyond LQL

Should you need to more powerful operators and aggregation capabilities, you can drop down to your backend querying engine.