This commit is contained in:
2023-09-28 21:44:03 +01:00
parent ca8de72f58
commit 348824af09
10 changed files with 179 additions and 16 deletions

View File

@@ -1,9 +1,3 @@
server_names_hash_bucket_size 64;
log_format telegraf-log '$remote_addr - $remote_user [$time_local]'
'"$request" $status $body_bytes_sent'
'"$http_referer" "$http_user_agent"'
'"$request_time" "$upstream_connect_time"'
'$http_host "xxx" "yyy"';
#'"$geoip_city" "$geoip_city_country_code"';
access_log /var/log/nginx/access-file.log telegraf-log;
log_format vhosts ' $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $host "$http_referer" "$http_user_agent"';
access_log /var/log/nginx/vhosts-access.log vhosts;

View File

@@ -1,13 +1,16 @@
[[inputs.nginx]]
urls = ["http://wansrv01:8080/stub_status"]
response_timeout = "5s"
[[inputs.tail]]
files = ["/var/log/nginx/access-file.log"]
files = ["/var/log/nginx/vhosts-access.log"]
from_beginning = true
name_override = "nginx_access_log"
grok_patterns = ["%{CUSTOM_LOG_FORMAT}"]
grok_custom_patterns = '''
CUSTOM_LOG_FORMAT %{CLIENT:client_ip} %{NOTSPACE:ident} %{NOTSPACE:auth} \[%{HTTPDATE:ts:ts-httpd}\]"(?:%{WORD:verb:tag} %{NOTSPACE:request}(?: HTTP/%{NUMBER:http_version:float})?|%{DATA})" %{NUMBER:resp_code:tag} (?:%{NUMBER:resp_bytes:int}|-)%{QS:referrer} %{QS:agent}%{QS:request_time} %{QS:upstream_connect_time}%{NOTSPACE:http_host:tag} %{QS:geoip_city} %{QS:country_code}
'''
name_override = "nginx_access-logv3"
grok_patterns = ["%{CUSTOM_LOG}"]
grok_custom_patterns = '''
CUSTOM_LOG %{COMMON_LOG_FORMAT} %{NOTSPACE:nginx_host} "%{DATA:referrer}" "%{DATA:agent}"
'''
data_format = "grok"