Skip to content

Metrics: rule checks log under random container names #8365

Todo

Description

@DavidePrincipi

Steps to reproduce

  • Install an application that ships its own alert rules for the Metrics module, or change its rules, so Metrics checks them. For example, publish a rule in module/<module_id>/metrics_alert_rules and emit the metrics-alert-rules-changed event.
  • Look at the system log of the node that runs Metrics, e.g. journalctl --since -1h _UID=$(id -u metrics1).

Expected behavior

Log lines written while Metrics checks the alert rules carry a fixed log name (syslog identifier), like the other Metrics services, e.g. prometheus.

Actual behavior

Every rule check runs promtool in a new, unnamed container. Podman gives each one a random name, and that name becomes the log name of its output. In one hour, a node with a single application rule set logged under more than 20 different random names:

Nov 24 17:53:41 node1 agitated_lamport[664506]:       (time() - porthos_snapshot_last_timestamp_seconds{__ns8_rule_scope="1",module_id="porthos1"})
... gallant_ardinghelli, wonderful_hellman, xenodochial_black, elastic_edison, festive_khayyam, ...

The Loki log server indexes log names, so the number of indexed values grows with every rule check and never stops. The lines are also hard to find, because they do not carry the Metrics name.

Components

Metrics 1.7.1, core 3.25.1

See also


Reported with Claude Code:claude-opus-5-5 and nethserver-issue

Activity

  1. moved this from Backlog to ToDo in NethServeron Nov 24, 2026
  2. moved this from ToDo to In Progress in NethServeron Dec 1, 2026
  3. DavidePrincipi commented on Dec 2, 2026

    @DavidePrincipi
    MemberAuthor

    Test case

    Image: ghcr.io/nethserver/metrics:1.7.2-dev.2

    1. Update Metrics to the test image:
      api-cli run update-module --data '{"module_url":"ghcr.io/nethserver/metrics:1.7.2-dev.2","instances":["metrics1"],"force":true}'
      
    2. Install an application that publishes alert rules (e.g. Porthos, see feat(metrics): alert on failed snapshot ns8-porthos#39), or publish a rule in module/<module_id>/metrics_alert_rules and emit the metrics-alert-rules-changed event.
    3. On the Metrics node, check that the rules are loaded: ls /home/metrics1/.config/state/rules.d/ lists the generated rule file, and the Prometheus UI shows the rules.
    4. Check the log: journalctl --since -10min _UID=$(id -u metrics1) -o json | jq -r .SYSLOG_IDENTIFIER | sort | uniq -c. Expected: only fixed names (e.g. prometheus, alertmanager, grafana, agent), no random container names like agitated_lamport.
    5. Publish an invalid rule (e.g. a broken PromQL expr) and emit the event again: the error is still logged under a fixed name and the invalid rule set is not loaded.
  4. added
    testing
    on Dec 2, 2026
  5. moved this from In Progress to Testing in NethServeron Dec 2, 2026
  6. removed their assignment
    on Dec 2, 2026
  7. added
    verified
    and removed
    testing
    on Dec 2, 2026
  8. moved this from Testing to Verified in NethServeron Dec 2, 2026
  9. gsanchietti commented on Dec 2, 2026

    @gsanchietti
    Member

    Verified with ghcr.io/nethserver/metrics:1.7.2-dev.2 on a single-node cluster: all steps pass.

    • Rules load in Prometheus with module_id scoping, a test alert fires.
    • Rule checks log only under fixed names, no random container names.
    • Invalid rule is skipped, error logged under agent@metrics9.

    Note: 1.7.2-dev.1 lacks the fix; the test case image should read 1.7.2-dev.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    verified

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions