Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.0] - unreleased
## [1.2.1] - unreleased

### Fixed
- **`{{ rule_name }}` available in top-level templates and throttle key** (issue #31). `rule_name` is now injected into the render context of `templates.<name>.title`, `body`, and `email_body_html`, and also into the `throttle.key` template, not just the notifier-level `subject_template` / `body_template`. Configs that referenced `{{ rule_name }}` in a top-level template previously rendered an empty string; they now render the rule name. If an event field happens to be literally named `rule_name`, the synthetic rule name wins, matching the collision policy of the existing notifier-level contexts.
- **Dotted event fields resolve in `throttle.key`**. The unflatten step introduced in v1.2.0 for template rendering (issue #25) now also applies to the throttle key template, so `throttle.key: "{{ nginx.http.status_code }}-{{ hostname }}"` works consistently with `title` / `body`.

## [1.2.0] - 2026-04-15

### Breaking changes
- **Template field `body_html` renamed to `email_body_html`** to reflect that
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "valerter"
version = "1.2.0"
version = "1.2.1"
edition = "2024"
description = "Real-time log alerting for VictoriaLogs"
license = "Apache-2.0"
Expand Down
7 changes: 7 additions & 0 deletions config/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,15 @@ defaults:
# streams configured server-side)
# <any parser-extracted field> JSON field or named regex group
# rule_name name of the triggered rule
# (available in `title`, `body`,
# `email_body_html`, `throttle.key`,
# and in notifier-level
# `subject_template` /
# `body_template`)
# log_timestamp event timestamp (ISO8601)
# (notifier-level templates only)
# log_timestamp_formatted human timestamp (defaults.timestamp_timezone)
# (notifier-level templates only)
#
# 2. Template OUTPUT KEYS that you define below (left-hand side). These are
# the slots valerter fills and hands off to notifiers:
Expand Down
7 changes: 7 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,18 @@ Variables come from the parser output plus built-in fields:
| `log_timestamp_formatted` | Human-readable timestamp (respects `timestamp_timezone` setting) |
| Custom fields | Extracted by regex/JSON parser |

**Note:** `rule_name` is available in all template contexts: the top-level
template fields (`title`, `body`, `email_body_html`), the `throttle.key`, and
the notifier-level templates (`subject_template`, `body_template`). If an
event field happens to be named `rule_name`, the synthetic rule name wins.

**Note:** `log_timestamp` and `log_timestamp_formatted` are available in:
- Email subject and body templates
- Webhook `body_template`
- Mattermost footer (automatically includes `log_timestamp_formatted`)

These timestamps are computed **after** the top-level template renders, so they are only accessible in notifier-level templates. If you need a timestamp at the top-level, reference `{{ _time }}` (raw VictoriaLogs field) directly.

### email_body_html Requirement

**Important:** Templates used with email destinations MUST include `email_body_html`. Valerter validates this at startup and will fail if missing.
Expand Down
Loading
Loading