Files
ansible-roles/roles/nginx/templates/vector.yml.j2
2025-07-28 13:00:23 +02:00

24 lines
620 B
Django/Jinja

---
sources:
in_logs_nginx:
type: file
include:
- /var/log/nginx/access.log
- /var/log/nginx/error.log
transforms:
format_logs_nginx:
type: remap
inputs:
- in_logs_nginx
source: |
if (.file == "/var/log/nginx/access.log"){
.http = parse_grok!(.message, "%{HOSTNAME:host} %{HTTPD_COMBINEDLOG}")
} else if (.file == "/var/log/nginx/error.log"){
.http = parse_nginx_log!(.message, format:"error")
}
.timestamp = parse_timestamp(del(.http.timestamp), format: "%d/%h/%Y:%H:%M:%S %z") ?? now()
.service = "nginx"
.group = "web"