1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
.. _param-omjournal-template:
.. _omjournal.parameter.input.template:
template
========
.. index::
single: omjournal; template
single: template
.. summary-start
Selects the template that formats journal entries before they are written.
.. summary-end
This parameter applies to :doc:`../../configuration/modules/omjournal`.
: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 <https://github.com/rsyslog/rsyslog/issues/881>`_
for background on the crash.
Journald requires that the template's output contains a field named ``MESSAGE``.
Input usage
-----------
.. _param-omjournal-input-template:
.. _omjournal.parameter.input.template-usage:
.. code-block:: shell
action(type="omjournal" template="journal")
See also
--------
See also :doc:`../../configuration/modules/omjournal`.
|