Fluentd
Search…
nginx
The nginx parser plugin parses the default Nginx logs.

Parameters

Regexp Patterns

Here is the regexp and time format patterns of this plugin:
1
expression /^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)"(?:\s+(?<http_x_forwarded_for>[^ ]+))?)?$/
2
time_format %d/%b/%Y:%H:%M:%S %z
Copied!
remote, user, method, path, code, size, referer, agent and http_x_forwarded_for are included in the event record. time is used for the event time.

Example

This incoming event:
1
127.0.0.1 192.168.0.1 - [28/Feb/2013:12:00:00 +0900] "GET / HTTP/1.1" 200 777 "-" "Opera/12.0" -
Copied!
is parsed as:
1
time:
2
1362020400 (28/Feb/2013:12:00:00 +0900)
3
4
record:
5
{
6
"remote" : "127.0.0.1",
7
"host" : "192.168.0.1",
8
"user" : "-",
9
"method" : "GET",
10
"path" : "/",
11
"code" : "200",
12
"size" : "777",
13
"referer" : "-",
14
"agent" : "Opera/12.0",
15
"http_x_forwarded_for": "-"
16
}
Copied!
If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is an open-source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.
Last modified 4mo ago