Skip to content

Query Syntax

DSL Syntax

bash
loq <file> [where <conditions>] [count [by <field>]] [limit <n>]

Operators

OperatorDescriptionExample
=Equalslevel=error
!=Not equalslevel!=debug
>Greater thanstatus>400
<Less thanstatus<500
>=Greater or equalstatus>=400
<=Less or equalstatus<=299
containsSubstring matchmessage contains "timeout"
matchesRegex matchpath matches "^/api/v[0-9]+"

Boolean Logic

bash
# AND
loq app.log where level=error and status>=500

# OR
loq app.log where level=error or level=warn

# NOT
loq app.log where not level=debug

# Grouping
loq app.log where "(level=error or level=warn) and status>=500"

Time Filters

bash
# After a time
loq app.log after yesterday

# Before a time
loq app.log before today

# Between times
loq app.log between "10:00" and "11:00" today

Aggregations

bash
# Count all
loq app.log count

# Count by field
loq app.log count by level

# With filter
loq app.log where status>=400 count by path

SQL Syntax

bash
loq "SELECT * FROM app.log WHERE level='error' LIMIT 10"
loq "SELECT level, COUNT(*) FROM app.log GROUP BY level"
loq "SELECT path, AVG(response_time) FROM access.log GROUP BY path"

Released under the MIT License.