master
yaml 164 lines 4.49 KB
Raw
1 # For all nginx variables, check this:
2 # https://nginx.org/en/docs/http/ngx_http_core_module.html#var_connection_requests
3
4 pattern: json
5
6 prefix: NGINX_
7
8 # When log2journal can detect the filename of each log entry (tail gives it
9 # only when it tails multiple files), this key will be used to send the
10 # filename to the journals.
11 filename:
12 key: NGINX_LOG_FILENAME
13
14 filter:
15 exclude: '^(NGINX_BINARY_REMOTE_ADDR)$'
16
17 rename:
18 - new_key: MESSAGE
19 old_key: NGINX_REQUEST
20
21 # args is an alias for query_string
22 - new_key: NGINX_QUERY_STRING
23 old_key: NGINX_ARGS
24
25 # document_uri is an alias for uri
26 - new_key: NGINX_URI
27 old_key: NGINX_DOCUMENT_URI
28
29 # is_args states if the request had a query string or not
30 - new_key: NGINX_HAS_QUERY_STRING
31 old_key: NGINX_IS_ARGS
32
33 # msec is the timestamp in seconds, with fractional digits for milliseconds
34 - new_key: NGINX_TIMESTAMP_SEC
35 old_key: NGINX_MSEC
36
37 # nginx_version is already prefixed with nginx, let's remove one of them
38 - new_key: NGINX_VERSION
39 old_key: NGINX_NGINX_VERSION
40
41 # pipe states if the request was pipelined or not
42 - new_key: NGINX_PIPELINED
43 old_key: NGINX_PIPE
44
45 # rename numeric TLVs to their names
46 - new_key: NGINX_PROXY_PROTOCOL_TLV_ALPN
47 old_key: NGINX_PROXY_PROTOCOL_TLV_0X01
48 - new_key: NGINX_PROXY_PROTOCOL_TLV_AUTHORITY
49 old_key: NGINX_PROXY_PROTOCOL_TLV_0X02
50 - new_key: NGINX_PROXY_PROTOCOL_TLV_UNIQUE_ID
51 old_key: NGINX_PROXY_PROTOCOL_TLV_0X05
52 - new_key: NGINX_PROXY_PROTOCOL_TLV_SSL
53 old_key: NGINX_PROXY_PROTOCOL_TLV_0X20
54 - new_key: NGINX_PROXY_PROTOCOL_TLV_NETNS
55 old_key: NGINX_PROXY_PROTOCOL_TLV_0X30
56
57 # rename numeric SSL TLVs to their names
58 - new_key: NGINX_PROXY_PROTOCOL_TLV_SSL_VERSION
59 old_key: NGINX_PROXY_PROTOCOL_TLV_SSL_0X21
60 - new_key: NGINX_PROXY_PROTOCOL_TLV_SSL_CN
61 old_key: NGINX_PROXY_PROTOCOL_TLV_SSL_0X22
62 - new_key: NGINX_PROXY_PROTOCOL_TLV_SSL_CIPHER
63 old_key: NGINX_PROXY_PROTOCOL_TLV_SSL_0X23
64 - new_key: NGINX_PROXY_PROTOCOL_TLV_SSL_SIG_ALG
65 old_key: NGINX_PROXY_PROTOCOL_TLV_SSL_0X24
66 - new_key: NGINX_PROXY_PROTOCOL_TLV_SSL_KEY_ALG
67 old_key: NGINX_PROXY_PROTOCOL_TLV_SSL_0X25
68
69 # Inject constant fields into the journal logs.
70 inject:
71 - key: SYSLOG_IDENTIFIER
72 value: nginx-log
73
74 # inject PRIORITY is a duplicate of NGINX_STATUS
75 - key: PRIORITY
76 value: '${NGINX_STATUS}'
77
78 # Inject NGINX_STATUS_FAMILY is a duplicate of NGINX_STATUS
79 - key: NGINX_STATUS_FAMILY
80 value: '${NGINX_STATUS}'
81
82
83 # Rewrite the value of fields (including the duplicated ones).
84 # The search pattern can have named groups, and the replace pattern can use
85 # them as ${name}.
86 rewrite:
87 # a ? means it has query string, everything else means it does not
88 - key: NGINX_HAS_QUERY_STRING
89 match: '^\?$'
90 value: yes
91 - key: NGINX_HAS_QUERY_STRING
92 match: '.*'
93 value: no
94
95 # 'on' means it was HTTPS, everything else means it was not
96 - key: NGINX_HTTPS
97 match: '^on$'
98 value: yes
99 - key: NGINX_HTTPS
100 match: '.*'
101 value: no
102
103 # 'p' means it was pipelined, everything else means it was not
104 - key: NGINX_PIPELINED
105 match: '^p$'
106 value: yes
107 - key: NGINX_PIPELINED
108 match: '.*'
109 value: no
110
111 # zero means client sent a certificate and it was verified, non-zero means otherwise
112 - key: NGINX_PROXY_PROTOCOL_TLV_SSL_VERIFY
113 match: '^0$'
114 value: yes
115 - key: NGINX_PROXY_PROTOCOL_TLV_SSL_VERIFY
116 match: '.*'
117 value: no
118
119 # 'OK' means request completed, everything else means it didn't
120 - key: NGINX_REQUEST_COMPLETION
121 match: '^OK$'
122 value: 'completed'
123 - key: NGINX_REQUEST_COMPLETION
124 match: '.*'
125 value: 'not completed'
126
127 # PRIORTY is a duplicate of NGINX_STATUS
128 # Valid PRIORITIES: 0=emerg, 1=alert, 2=crit, 3=error, 4=warn, 5=notice, 6=info, 7=debug
129 - key: PRIORITY
130 match: '^[123]'
131 value: 6
132
133 - key: PRIORITY
134 match: '^4'
135 value: 5
136
137 - key: PRIORITY
138 match: '^5'
139 value: 3
140
141 - key: PRIORITY
142 match: '.*'
143 value: 4
144
145 # NGINX_STATUS_FAMILY is a duplicate of NGINX_STATUS
146 - key: NGINX_STATUS_FAMILY
147 match: '^(?<first_digit>[1-5])'
148 value: '${first_digit}xx'
149
150 - key: NGINX_STATUS_FAMILY
151 match: '.*'
152 value: 'UNKNOWN'
153
154 # Control what to do when input logs do not match the main PCRE2 pattern.
155 unmatched:
156 # The journal key to log the PCRE2 error message to.
157 # Set this to MESSAGE, so you to see the error in the log.
158 key: MESSAGE
159
160 # Inject static fields to the unmatched entries.
161 # Set PRIORITY=1 (alert) to help you spot unmatched entries in the logs.
162 inject:
163 - key: PRIORITY
164 value: 1