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): add an example of parsing upstreaminfo with parse_nginx_log #18815

Merged
merged 4 commits into from
Oct 12, 2023
Merged
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
31 changes: 31 additions & 0 deletions website/cue/reference/remap/functions/parse_nginx_log.cue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ remap: functions: parse_nginx_log: {
"""
Missing information in the log message may be indicated by `-`. These fields are omitted in the result.
""",
"""
In case of `ingress_upstreaminfo` format the following fields may be safely omitted in the log message: `remote_addr`, `remote_user`, `http_referer`, `http_user_agent`, `proxy_alternative_upstream_name`, `upstream_addr`, `upstream_response_length`, `upstream_response_time`, `upstream_status`.
""",
]

arguments: [
Expand Down Expand Up @@ -93,5 +96,33 @@ remap: functions: parse_nginx_log: {
host: "localhost:8081"
ex5 marked this conversation as resolved.
Show resolved Hide resolved
}
},
{
pront marked this conversation as resolved.
Show resolved Hide resolved
title: "Parse via Nginx log format (ingress_upstreaminfo)"
source: #"""
parse_nginx_log!(
s'0.0.0.0 - bob [18/Mar/2023:15:00:00 +0000] "GET /some/path HTTP/2.0" 200 12312 "https://10.0.0.1/some/referer" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" 462 0.050 [some-upstream-service-9000] [some-other-upstream-5000] 10.0.50.80:9000 19437 0.049 200 752178adb17130b291aefd8c386279e7',
"ingress_upstreaminfo"
)
"""#
return: {
body_bytes_size: 12312
http_referer: "https://10.0.0.1/some/referer"
http_user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
proxy_alternative_upstream_name: "some-other-upstream-5000"
proxy_upstream_name: "some-upstream-service-9000"
remote_addr: "0.0.0.0"
remote_user: "bob"
req_id: "752178adb17130b291aefd8c386279e7"
request: "GET /some/path HTTP/2.0"
request_length: 462
request_time: 0.050
status: 200
timestamp: "2023-03-18T15:00:00Z"
upstream_addr: "10.0.50.80:9000"
upstream_response_length: 19437
upstream_response_time: 0.049
upstream_status: 200
}
},
]
}
Loading