Raw query: Calls the /select/logsql/query endpoint. The returned data can be viewed as a two-dimensional table. In threshold mode, "label fields" and "value fields" need to be mapped.
Statistics: Calls the /select/logsql/stats_query endpoint. The returned data follows the Prometheus protocol format. Monitors automatically identifies which fields are labels and which are values, requiring no additional configuration.
VictoriaLogs data sources still support three alert modes. The data exists mode is most recommended as it is most suitable for log scenarios.
Query statement: Example: error | fields _time, _stream, _msg | sort by (_time) desc
Result limit: This configuration limits the maximum number of rows returned by a query to avoid performance impact from returning too much data in a single query. In Monitors, the maximum can be set to 100.
Time range: Specify the query time window, such as "last 5 minutes".
Label fields: Specify which fields in the query results serve as labels for the alert object, used to distinguish different alert entities. Multiple label fields can be configured. If left empty, Monitors will treat all fields except the value field as label fields.
Value field: Specify which field in the query results serves as the numeric value for threshold evaluation. This is usually a numeric type field. Required in threshold mode, optional in other modes.
Query statement: Example: _time:1d | stats by (level) count(*) total
No other parameters: Note that the query statement must include a _time filter condition, such as _time:5m, to limit the query time range. Otherwise, it queries all data, which may cause performance issues.
Automatic recovery: When the latest query result shows that an object's value no longer meets any alert threshold, a recovery event is automatically generated.
Specific recovery condition: A recovery expression can be configured, such as $A.total < 10, to only consider recovery when the error count drops below 10, reducing flapping.
Recovery query: A separate VictoriaLogs query statement can be configured for recovery evaluation.How it works: After an alert is triggered, Monitors periodically executes this recovery query statement. As long as the query returns data (i.e., the result is not empty), the incident is considered recovered.
Variable support: The recovery query statement supports embedded variables (format: ${label_name}), which are automatically replaced with the corresponding label values from the alert event, allowing the recovery query to detect specific alert objects.