# template

Selects the template that formats journal entries before they are written.

This parameter applies to omjournal: Systemd Journal Output.

Name:

  template

Scope:

  input

Type:

  word

Default:

  none

Required?:

  no

Introduced:

  8.17.0

## Description

Template to use when submitting messages.

By default, rsyslog will use the incoming `$msg` property as the `MESSAGE` field of the journald entry. It also includes `SYSLOG_IDENTIFIER` (from the tag), `SYSLOG_FACILITY`, and `PRIORITY` (derived from facility and severity).

You can override the default formatting of the message, and include custom fields with a template.

Warning

Complex JSON objects or arrays from `json` or `subtree` templates are not supported. The omjournal action currently converts each field via `json_object_get_string()`, which returns `NULL` for nested JSON structures and leads to a crash inside `build_iovec()`. Emit only values that convert cleanly to strings (plain text, numbers, booleans) until this limitation is fixed. See rsyslog issue #881 for background on the crash.

Journald requires that the template’s output contains a field named `MESSAGE`.

## Input usage

    action(type="omjournal" template="journal")

## See also

See also omjournal: Systemd Journal Output.

Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project

Contributing: Source & docs: rsyslog source project

© 2008–2025 Rainer Gerhards and others. Licensed under the Apache License 2.0.