echo '::1 - - [18/Jul/2022:07:28:01 +0000] "GET /hello/ilogtail HTTP/1.1" 404 153 "-" "curl/7.74.0" "-"' >> /home/test-log/nginx.log
enable: true
inputs:
- Type: input_file
FilePaths:
- /home/test-log/*.log
processors:
- Type: processor_regex
SourceKey: content
Regex: '([\d\.:]+) - (\S+) \[(\S+) \S+\] \"(\S+) (\S+) ([^\\"]+)\" (\d+) (\d+) \"([^\\"]*)\" \"([^\\"]*)\" \"([^\\"]*)\"'
Keys:
- remote_addr
- remote_user
- time_local
- method
- url
- protocol
- status
- body_bytes_sent
- http_referer
- http_user_agent
- http_x_forwarded_for
- Type: processor_log_to_sls_metric
MetricLabelKeys:
- url
- method
MetricValues:
remote_addr: status
CustomMetricLabels:
nginx: test
IgnoreError: false
flushers:
- Type: flusher_stdout
OnlyStdout: true
{
"__labels__":"method#$#GET|nginx#$#test|url#$#/hello/ilogtail",
"__name__":"::1",
"__value__":"404",
"__time_nano__":"1688956340000000000",
"__time__":"1688956340"
}