Skip to content

Is it possible to show actual log message in received message? #81

@bonzonkim

Description

@bonzonkim

Is your question request related to a specific component?

VictoriaLogs

Describe the question in detail

I deployed VictoriaLogs, Vmalert to send alert.

what I want to do is,
if alert is fire, send alert to slack and the actual log message shown in the slack message label.
for example,
log

2025-03-21 16:26:49.182 47794:C 21 Mar 2025 16:26:47.592 * DB saved on disk

slack

[FIRING:2] Test-Alert for  (alertname="Test-Alert", alertgroup="Test", severity="critical")
Alert:  - critical
Description: LOGS: 47794:C 21 Mar 2025 16:26:47.592 * DB saved on disk
Details:
  • alertname: Test-Alert
  • alertgroup: Test
  • datasource: victoriaLogs
  • env: dev
  • severity: critical
  • stats_result: errLogs

this is my vmalert values.yaml

server:
  # Victoria logs
  datasource:
    url: "my-vlog.com"
  # Alertmanager in prometheus namespace
  notifier:
    alertmanager:
      url: "my-vmalert.com"

  ingress:
    enabled: true
    annotations: 
      kubernetes.io/ingress.class: nginx
    hosts:
      - name: my-vmalert.com
        path:
          - /

    tls: 
      - secretName: my-tls
        hosts:
          - my-vmalert.com
    ingressClassName: "nginx"
    pathType: Prefix

  config:
    alerts:
      groups: 
        - name: Test
          type: vlogs
          rules:
            - alert: Test-Alert
              expr: _time:3m component:redis "DB saved on disk" as errLog | stats count() as errCount | filter errCount:>0
              for: 1m
              labels:
                severity: critical
                datasource: victoriaLogs
                env: dev
              annotations:
                description: "LOGS: {{$labels.errLog}} | {{$errLog}}"

{{.Labels.errLog}}, {{$labels.errLog}}, {{$errLog}}, {{$values}} does now working.
something wrong? or just LogsQL does not support this type of expression?

Troubleshooting docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionAsking about a problem, or not sure whether the issue is an enhancement or a bug.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions