Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nginx
GitHub Repository: nginx/nginx.org
Path: blob/main/xml/en/docs/syslog.xml
1 views
1
<?xml version="1.0"?>
2
3
<!--
4
Copyright (C) Nginx, Inc.
5
-->
6
7
<!DOCTYPE article SYSTEM "../../../dtd/article.dtd">
8
9
<article name="Logging to syslog"
10
link="/en/docs/syslog.html"
11
lang="en"
12
rev="6">
13
14
<section>
15
16
<para>
17
The
18
<link doc="ngx_core_module.xml" id="error_log"/>
19
and
20
<link doc="http/ngx_http_log_module.xml" id="access_log"/>
21
directives support logging to syslog.
22
The following parameters configure logging to syslog:
23
<list type="tag">
24
25
<tag-name><literal>server=</literal><value>address</value></tag-name>
26
<tag-desc>
27
Defines the address of a syslog server.
28
The address can be specified as a domain name or IP address,
29
with an optional port, or as a UNIX-domain socket path
30
specified after the “<literal>unix:</literal>” prefix.
31
If port is not specified, the UDP port 514 is used.
32
If a domain name resolves to several IP addresses, the first resolved
33
address is used.
34
</tag-desc>
35
36
<tag-name><literal>facility=</literal><value>string</value></tag-name>
37
<tag-desc>
38
Sets facility of syslog messages, as defined in
39
<link url="https://datatracker.ietf.org/doc/html/rfc3164#section-4.1.1">RFC 3164</link>.
40
Facility can be one of “<literal>kern</literal>”, “<literal>user</literal>”,
41
<literal>mail</literal>”, “<literal>daemon</literal>”,
42
<literal>auth</literal>”, “<literal>intern</literal>”,
43
<literal>lpr</literal>”, “<literal>news</literal>”, “<literal>uucp</literal>”,
44
<literal>clock</literal>”, “<literal>authpriv</literal>”,
45
<literal>ftp</literal>”, “<literal>ntp</literal>”, “<literal>audit</literal>”,
46
<literal>alert</literal>”, “<literal>cron</literal>”,
47
<literal>local0</literal>”..“<literal>local7</literal>”.
48
Default is “<literal>local7</literal>”.
49
</tag-desc>
50
51
<tag-name><literal>severity=</literal><value>string</value></tag-name>
52
<tag-desc>
53
Sets severity of syslog messages for
54
<link doc="http/ngx_http_log_module.xml" id="access_log"/>,
55
as defined in
56
<link url="https://datatracker.ietf.org/doc/html/rfc3164#section-4.1.1">RFC 3164</link>.
57
Possible values are the same as for the second parameter (level) of the
58
<link doc="ngx_core_module.xml" id="error_log"/> directive.
59
Default is “<literal>info</literal>”.
60
<note>
61
Severity of error messages is determined by nginx, thus the parameter
62
is ignored in the <literal>error_log</literal> directive.
63
</note>
64
</tag-desc>
65
66
<tag-name><literal>tag=</literal><value>string</value></tag-name>
67
<tag-desc>
68
Sets the tag of syslog messages.
69
Default is “<literal>nginx</literal>”.
70
</tag-desc>
71
72
<tag-name><literal>nohostname</literal></tag-name>
73
<tag-desc>
74
Disables adding the “hostname” field into the syslog message header (1.9.7).
75
</tag-desc>
76
77
<!--
78
<tag-name><literal>bare=</literal><literal>on</literal> |
79
<literal>off</literal></tag-name>
80
<tag-desc>
81
If enabled, messages are sent without syslog headers.
82
Default is <literal>off</literal>.
83
</tag-desc>
84
-->
85
86
</list>
87
Example syslog configuration:
88
<example>
89
error_log syslog:server=192.168.1.1 debug;
90
91
access_log syslog:server=unix:/var/log/nginx.sock,nohostname;
92
access_log syslog:server=[2001:db8::1]:12345,facility=local7,tag=nginx,severity=info combined;
93
</example>
94
</para>
95
96
<para>
97
<note>
98
Logging to syslog is available since version 1.7.1.
99
As part of our
100
<commercial_version>commercial subscription</commercial_version>
101
logging to syslog is available since version 1.5.3.
102
</note>
103
</para>
104
105
</section>
106
107
</article>
108
109