-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fixing timestamp manually seems to work in VRL but throw errors when applied to Vector config #21812
Comments
Hi @michellabbe, thank you for providing all the details. However, I set this up locally and I cannot reproduce.
A few things to note here:
|
To be clear, there's no link between these two fields. The The original error was Since the examples with fake dates work, you will need to debug what happens with real logs. |
A note for the community
Problem
I'm exporting Traefik access logs in a
JSON
file, and using Vector (timberio/vector:latest-alpine
docker image) to forward the logs to a Graylog server.The configuration below works fine except timestamp in the access log isn't recognized.
Traefik saves ISO8601 timestamp in a field named
time
format, and finaltimestamp
in Graylog differ from thetime
field:While I could customize Traefik log format to rename
time
astimestamp
, this would force me to maintain the custom format on any change. It would be much easier to teach Vector to use the defaulttime
field, and at first it seemed very easy to do.Copy
time
totimestamp
in VRL seems to work:When applied to the vector config file (uncomment the line from the Configuration section below), Vector container log throws this error on the next access log:
-edit- Same behavior when trying to rename the field using
.timestamp = del(.time)
instead of copying it.The
time
field is defined exactly the same and works fine so that definitely looks like a bug in Vector.There doesn't seem to be a way to specify
type = timestamp
so let's tryparse_timestamp
instead.Again, in VRL again seems to work:
That's a long shot but let's try anyway.
Also note that the parsed timestamp got switched to
UTC
, which doesn't seem to be revertable before sinking it (ref: #3333 ).While I prefer to keep times in
local
timezone as much as possible for readability, it shouldn't be an issue as timezone is specified in the value.When applied to Vector config file, Vector container log throws this error on the next access log:
I thought maybe the
timestamp
field is treated special so I tried the same functions with other field names, with the same results.Configuration
Version
0.42.0
Debug Output
No response
Example Data
{ "ClientAddr": "192.168.0.33:54978", "ClientHost": "192.168.0.33", "ClientPort": "54978", "ClientUsername": "-", "DownstreamContentSize": 569679, "DownstreamStatus": 200, "Duration": 699781673, "OriginContentSize": 569679, "OriginDuration": 699595289, "OriginStatus": 200, "Overhead": 186384, "RequestAddr": "cadvisor.docker2.mlabbe.lan:443", "RequestContentSize": 0, "RequestCount": 1, "RequestHost": "cadvisor.docker2.mlabbe.lan", "RequestMethod": "GET", "RequestPath": "/metrics", "RequestPort": "443", "RequestProtocol": "HTTP/2.0", "RequestScheme": "https", "RetryAttempts": 0, "RouterName": "cadvisor@docker", "ServiceAddr": "192.168.80.6:8080", "ServiceName": "cadvisor-service@docker", "ServiceURL": "http://192.168.80.6:8080", "SpanId": "0000000000000000", "StartLocal": "2024-11-07T22:15:13.010239743-05:00", "TLSCipher": "TLS_AES_128_GCM_SHA256", "TLSVersion": "1.3", "TraceId": "00000000000000000000000000000000", "downstream_Content-Encoding": "gzip", "downstream_Content-Type": "text/plain; version=0.0.4; charset=utf-8", "downstream_Date": "Fri, 08 Nov 2024 03:15:13 GMT", "entryPointName": "websecure", "level": "info", "msg": "", "origin_Content-Encoding": "gzip", "origin_Content-Type": "text/plain; version=0.0.4; charset=utf-8", "origin_Date": "Fri, 08 Nov 2024 03:15:13 GMT", "request_Accept": "application/openmetrics-text;version=1.0.0;q=0.5,application/openmetrics-text;version=0.0.1;q=0.4,text/plain;version=0.0.4;q=0.3,/;q=0.2", "request_Accept-Encoding": "gzip", "request_User-Agent": "Prometheus/2.55.0", "request_X-Forwarded-Host": "cadvisor.docker2.mlabbe.lan:443", "request_X-Forwarded-Port": "443", "request_X-Forwarded-Proto": "https", "request_X-Forwarded-Server": "traefik", "request_X-Prometheus-Scrape-Timeout-Seconds": "45", "request_X-Real-Ip": "192.168.0.33", "time": "2024-11-07T22:15:13-05:00" }
Additional Context
No response
References
No response
The text was updated successfully, but these errors were encountered: