Workers_Trace_events and Logpush via HTTP
Following the docs, I'm using the following command to enable logpush:
When executing the following command, I'm getting the following error:
{"errors":[{"code":1002,"message":"error parsing input: invalid JSON syntax"}],"messages":[],"result":null,"success":false}
It doesn't appear to be anything wrong with my input (chat gpt agrees 😆 )16 Replies
Can anyone help with the above?
Looks like it's the newline after the end of your destination_conf and the string ending
i.e
Should be
btw you can use the dashboard to set up Trace events logpush jobs as well, Account level Analytics & Logs -> Logs,
Magic Link: https://dash.cloudflare.com/?to=/:account/logs
The above still doesn't fix the issue. I receive the following:
{"errors":[{"code":1002,"message":"error validating destination: error writing object: error uploading to https: 406 Couldn't parse JSON content. - Error(\"expected value\", line: 1, column: 1)"}],"messages":[],"result":null,"success":false}
I don't think you can setup trace event logpush in the dashboard for httpAhh yea you can't
Well, one step further.
It looks like CF is fine with the config now, but your configured http endpoint, logtail, is respnding with
http 406 / Couldn't parse JSON content. - Error("expected value", line: 1, column: 1)"
Interesting, thanks for the info. The following command works on my endpoint:
hmm, it looks like the first event it sends is just
Updated command is as follows:
I wonder if it's something with
header_Content-Type=application%2Fjson
using some webhook testing tools show that the content-type header is coming through okay, so I'm stumped
The raw content looks like the following though: ? n????{"content":"test"}?????]
it looks like that's the problem ^Probably.. that's weird though. I use logpush with Datadog and no issues, not sure what kind of characters those are
Yeah, I just changed the url to
webhook.site
to test this outHere's a screenshot:
Tried another tool and I see the same, and also an indication that "the request is not valid json"
Looks like it's \u001f
Unicode Character 'INFORMATION SEPARATOR ONE' (U+001F)
(at least, the first character is)
Seems like a logpush bug, no?
ahhhh it's because they're sent gzip content-encoding, you have to decompress them first
https://discord.com/channels/595317990191398933/1041788765783474216/1044660891817349202
Someone build a CF Worker to handle this already:
https://discord.com/channels/595317990191398933/1041788765783474216/1045370046622474281
Got it, thanks for the help! Hopefully there is an
output_options
to prevent this, but if not I will create a proxy. Really appreciate it!Doesn't look like there is as far as I can see.
But yea, you could just use the CF Worker DSA Made with some minor to forward to Logtail instead. If you need help with that let me know, I was able to get it working.