master
yaml 76 lines 1.63 KB
Raw
1 pattern: |
2 (?x) # Enable PCRE2 extended mode
3 ^
4 (?<NGINX_REMOTE_ADDR>[^ ]+) \s - \s # NGINX_REMOTE_ADDR
5 (?<NGINX_REMOTE_USER>[^ ]+) \s # NGINX_REMOTE_USER
6 \[
7 (?<NGINX_TIME_LOCAL>[^\]]+) # NGINX_TIME_LOCAL
8 \]
9 \s+ "
10 (?<MESSAGE>
11 (?<NGINX_METHOD>[A-Z]+) \s+ # NGINX_METHOD
12 (?<NGINX_URL>[^ ]+) \s+
13 HTTP/(?<NGINX_HTTP_VERSION>[^"]+)
14 )
15 " \s+
16 (?<NGINX_STATUS>\d+) \s+ # NGINX_STATUS
17 (?<NGINX_BODY_BYTES_SENT>\d+) \s+ # NGINX_BODY_BYTES_SENT
18 "(?<NGINX_HTTP_REFERER>[^"]*)" \s+ # NGINX_HTTP_REFERER
19 "(?<NGINX_HTTP_USER_AGENT>[^"]*)" # NGINX_HTTP_USER_AGENT
20
21 prefix: NGINX_
22
23 filename:
24 key: NGINX_LOG_FILENAME
25
26 filter:
27 include: '.*'
28 exclude: '.*HELLO.*WORLD.*'
29
30 rename:
31 - new_key: TEST1
32 old_key: TEST2
33 - new_key: TEST3
34 old_key: TEST4
35
36 inject:
37 - key: SYSLOG_IDENTIFIER
38 value: 'nginx-log'
39 - key: SYSLOG_IDENTIFIER2
40 value: 'nginx-log2'
41 - key: PRIORITY
42 value: '${NGINX_STATUS}'
43 - key: NGINX_STATUS_FAMILY
44 value: '${NGINX_STATUS}${NGINX_METHOD}'
45
46 rewrite:
47 - key: "PRIORITY"
48 value: "${NGINX_STATUS}"
49 inject: yes
50 stop: no
51 - key: "PRIORITY"
52 match: "^[123]"
53 value: 6
54 - key: "PRIORITY"
55 match: "^4"
56 value: 5
57 - key: "PRIORITY"
58 match: "^5"
59 value: 3
60 - key: "PRIORITY"
61 match: ".*"
62 value: 4
63 - key: "NGINX_STATUS_FAMILY"
64 match: "^(?<first_digit>[1-5])"
65 value: "${first_digit}xx"
66 - key: "NGINX_STATUS_FAMILY"
67 match: ".*"
68 value: "UNKNOWN"
69
70 unmatched:
71 key: MESSAGE
72 inject:
73 - key: PRIORITY
74 value: 1
75 - key: PRIORITY2
76 value: 2