Skip to content

Commit

Permalink
docs(vrl): update documentation for parse_nginx_log with the main
Browse files Browse the repository at this point in the history
… log format

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
  • Loading branch information
virtualtam committed Jan 3, 2025
1 parent 5cad353 commit 84415a0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
24 changes: 23 additions & 1 deletion website/cue/reference/remap/functions/parse_nginx_log.cue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ remap: functions: parse_nginx_log: {
category: "Parse"
description: """
Parses Nginx access and error log lines. Lines can be in [`combined`](\(urls.nginx_combined)),
[`ingress_upstreaminfo`](\(urls.nginx_ingress_upstreaminfo)), or [`error`](\(urls.nginx_error)) format.
[`ingress_upstreaminfo`](\(urls.nginx_ingress_upstreaminfo)), [`main`](\(urls.nginx_main))
or [`error`](\(urls.nginx_error)) format.
"""
notices: [
"""
Expand Down Expand Up @@ -42,6 +43,7 @@ remap: functions: parse_nginx_log: {
"combined": "Nginx combined format"
"error": "Default Nginx error format"
"ingress_upstreaminfo": "Provides detailed upstream information (Nginx Ingress Controller)"
"main": "Nginx main format used by Docker images"
}
type: ["string"]
},
Expand Down Expand Up @@ -124,5 +126,25 @@ remap: functions: parse_nginx_log: {
upstream_status: 200
}
},
{
title: "Parse via Nginx log format (main)"
source: #"""
parse_nginx_log!(
s'172.24.0.3 - alice [31/Dec/2024:17:32:06 +0000] "GET / HTTP/1.1" 200 615 "https://domain.tld/path" "curl/8.11.1" "1.2.3.4, 10.10.1.1"',
"main"
)
"""#
return: {
http_referer "https://domain.tld/path"
remote_addr "172.24.0.3"
remote_user "alice"
body_bytes_size 615
http_user_agent "curl/8.11.1"
http_x_forwarded_for "1.2.3.4, 10.10.1.1"
request "GET / HTTP/1.1"
status 200
timestamp "2024-12-31T17:32:06Z"
}
},
]
}
1 change: 1 addition & 0 deletions website/cue/reference/urls.cue
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ urls: {
nginx: "https://www.nginx.com/"
nginx_combined: "https://nginx.org/en/docs/http/ngx_http_log_module.html"
nginx_ingress_upstreaminfo: "https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/log-format/"
nginx_main "https://hg.nginx.org/pkg-oss/file/tip/debian/debian/nginx.conf"
nginx_error: "https://github.com/nginx/nginx/blob/branches/stable-1.18/src/core/ngx_log.c#L102"
nginx_stub_status_module: "http://nginx.org/en/docs/http/ngx_http_stub_status_module.html"
nix: "https://nixos.org/nix/"
Expand Down

0 comments on commit 84415a0

Please sign in to comment.