-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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. |
It's not about the Let's forget about I'm only trying to duplicate field named Create
Create
(I figured out using Start vector container, using the two files we just created:
The transform that works in playground returns a
It looks like the I don't see anything particular about it in your test setup file either, but you didn't seem to test with docker (which by design eliminates "I can't reproduce on my side" issues). I tried adding File Descriptor but I can't figure out (yet) proper syntax for this test case. The single real-life example provided isn't helping much when trying to figure out how to use this for the first time. |
@michellabbe one issue I see here is that you are not parsing the input as JSON and so the remapping you are doing will have no effect (because there is no
|
|
That helps alot, thanks! It works with my last example. However, when applying the
Is it possible to extract only the specific field I need from something like (obviously wrong syntax):
|
Yeah, that would work. I'd suggest assigning to a variable and then only extracting the fields you want like:
|
It seems like Jesse already got to the bottom of this 👍 I just wanted to share a simple config that I personally find useful when debugging:
The API enablement will allow you to use Based on this discussion I am confident this not a bug in Vector so I will close this issue. But feel free to followup. |
I confirm it works (and definitely not a bug in vector). Thanks again!
Using the example data from my original post,
|
Thanks for sharing too. I'll need to try out As mentioned, I only started playing with vector recently, looking for a replacement for filebeat. The documentation is full of resources, but implementations are not always easy to figure out as a new user (kinda lacks more real-life examples to put implementations in context). However I have to say I keep being impressed as I play with it :) |
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: