-
Notifications
You must be signed in to change notification settings - Fork 7
/
nginx.patch
53 lines (52 loc) · 1.67 KB
/
nginx.patch
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
diff --git a/config_handler/mapping/logging_plugins_mapping.yaml b/config_handler/mapping/logging_plugins_mapping.yaml
index ffa5cc6..894cb5a 100644
--- a/config_handler/mapping/logging_plugins_mapping.yaml
+++ b/config_handler/mapping/logging_plugins_mapping.yaml
@@ -151,4 +151,46 @@ linux-syslog:
match:
flush_interval: 30s
-default_flush_interval: 60s
\ No newline at end of file
+default_flush_interval: 60s
+
+
+nginx-error:
+ source:
+ '@type': tail
+ format: nginx
+ path: '/var/log/nginx/error.log'
+ pos_file: '/var/log/td-agent/nginx_error.pos'
+ parse:
+ '@type': regexp
+ time_format: '%Y/%m/%d %H:%M:%S'
+ expression: '(?<time>[^ ]* [^ ]*)\s*\[(?<level>\S+)\]\s*(?<pid>\d+)#(?<tid>\d+)(?<message>.*)$'
+ transform:
+ node: '#{Socket.gethostname}'
+ file: '${tag_suffix[1]}'
+ _plugin: 'nginx'
+ _documentType: 'error'
+ time: ${require 'time'; time.to_time.to_i}
+ match:
+ flush_interval: 30s
+
+
+nginx-access:
+ source:
+ '@type': tail
+ format: nginx
+ path: '/var/log/nginx/access.log'
+ pos_file: '/var/log/td-agent/nginx_access.pos'
+ parse:
+ '@type': regexp
+ time_format: '%d/%b/%Y:%H:%M:%S %z'
+ expression: '^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)" (?<gzip_ratio>[^ ]*))?$'
+ types: 'gzip_ratio:integer'
+ transform:
+ node: '#{Socket.gethostname}'
+ file: '${tag_suffix[1]}'
+ _plugin: 'nginx'
+ _documentType: 'access'
+ time: ${require 'time'; time.to_time.to_i}
+ level: 'info'
+ match:
+ flush_interval: 30s