Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(vrl): update documentation for parse_nginx_log with the main log format #22119

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions website/cue/reference/remap/functions/parse_nginx_log.cue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package metadata
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.
"""
Parses Nginx access and error log lines. Lines can be in [`combined`](\(urls.nginx_combined)),
[`ingress_upstreaminfo`](\(urls.nginx_ingress_upstreaminfo)), [`main`](\(urls.nginx_main)) or [`error`](\(urls.nginx_error)) format.
"""
notices: [
"""
Missing information in the log message may be indicated by `-`. These fields are omitted in the result.
Expand Down Expand Up @@ -42,6 +42,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 +125,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: {
body_bytes_size: 615
http_referer: "https://domain.tld/path"
http_user_agent: "curl/8.11.1"
http_x_forwarded_for: "1.2.3.4, 10.10.1.1"
remote_addr: "172.24.0.3"
remote_user: "alice"
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
Loading