summaryrefslogtreecommitdiff
path: root/docs/manual/mod/mod_journald.xml
blob: c9c56d3b2d53a3c5ad8dcd0dc77098419dd8c30c (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->

<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<modulesynopsis metafile="mod_journald.xml.meta">

<name>mod_journald</name>
<description>Provides "journald" ErrorLog provider</description>
<status>Extension</status>
<sourcefile>mod_journald.c</sourcefile>
<identifier>journald_module</identifier>

<summary>
    <p>This module provides "journald" ErrorLog provider. It allows logging
    error messages and CustomLog/TransferLog via systemd-journald(8).</p>
</summary>

<section id="structured">
    <title>Structured logging</title>
    <p>Systemd-journald allows structured logging and therefore it is
    possible to filter logged messages according to various variables.
    Currently supported variables are:
    </p>
    <dl>
      <dt><code>LOG</code></dt>
      <dd>The name of the log. For ErrorLog, the value is "error_log".
          For CustomLog or TransferLog, the value is the first argument of
          these directives.</dd>
      <dt><code>REQUEST_HOSTNAME</code></dt>
      <dd>Host, as set by full URI or Host: header in the request.</dd>
      <dt><code>REQUEST_USER</code></dt>
      <dd>If an authentication check was made, this gets set to the user
          name.</dd>
      <dt><code>REQUEST_USERAGENT_IP</code></dt>
      <dd>The address that originated the request.</dd>
      <dt><code>REQUEST_URI</code></dt>
      <dd>The path portion of the URI, or "/" if no path provided.</dd>
      <dt><code>SERVER_HOSTNAME</code></dt>
      <dd>The hostname of server for which the log message has been
          generated.</dd>
    </dl>

    <p>These variables can be for example used to show only log messages
    for particular URI using <code>journalctl</code>:
    </p>

    <highlight>journalctl REQUEST_URI=/index.html -a</highlight>

    <p>For more examples, see systemd-journalctl documentation.</p>
</section>

<section id="examples">
    <title>Examples</title>

    <p>Using <code>journald</code> in ErrorLog directive (see <module>core</module>)
    instead of a filename enables logging via systemd-journald(8)
    if the system supports it.
    </p>

    <highlight language="config">
ErrorLog journald
    </highlight>

    <p>Using <code>journald</code> as an error log provider in CustomLog
    directive (see <module>mod_log_config</module>) enables
    logging via systemd-journald(8) if the system supports it.
    </p>

    <highlight language="config">
CustomLog "journald" "%h %l %u %t \"%r\" %>s %b"
    </highlight>

    <note type="warning"><title>Performance warning</title><p>
    Currently, systemd-journald is not designed for high-throughput logging
    and logging access_log to systemd-journald could decrease the performance
    a lot.
    </p></note>

</section>

</modulesynopsis>