Back to Nightingale

VictoriaLogs Queries

aiagent/skill/embedded/builtin/query-datasource/datasources/victorialogs.md

9.1.11.3 KB
Original Source

VictoriaLogs Queries

  • plugin_type: victorialogs
  • Query language: LogsQL
  • Use case: Log queries

Call the native VictoriaLogs API through the proxy.


Search Logs

GET /api/n9e/proxy/<datasource_id>/select/logsql/query?query=<logsql>&start=<unix_ts>&end=<unix_ts>&limit=100
Authorization: Bearer <token>
ParameterTypeRequiredDescription
querystringYesLogsQL query expression
startint64NoStart time, Unix timestamp (seconds)
endint64NoEnd time, Unix timestamp (seconds)
limitintNoNumber of log lines to return

Common LogsQL Examples

RequirementLogsQL
Search logs containing error_msg:error
Multiple conditions with AND_msg:error AND service:payment
Filter by time stream_stream:{job="myapp"} AND _msg:error
Exclude a keyword_msg:error NOT _msg:debug
Regex match_msg:~"timeout|refused"

Considerations

  • Timestamps are in seconds: Unlike Loki, VictoriaLogs time parameters use second-level Unix timestamps
  • LogsQL, not LogQL: VictoriaLogs uses the LogsQL query language, whose syntax differs from Loki's LogQL
  • _msg field: The default log content field is _msg
  • _stream field: Used for filtering by log stream