axiomhq/next-axiom

Log drains or the HTTP logger

Closed this issue · 7 comments

All of your documentations points to first installing the integration with Vercel which uses the Log Drains to ingest logs from Vercel directly to Axiom, but then the logger that this library exports uses the Axiom HTTP API directly to send logs to Axiom.

I understand that frontend may need to use the HTTP API but on the server is totally not necessary.

Was that intentional? Are there plans to change this behaviour?

hi @kostas-pblworks , currently you can use console.log() and the logdrain to ship logs to Axiom, but they will be sent as text lines. If you want to send structured logs, you would have to use next-axiom or one of your SDKs.

There is one idea to make next-axiom using console.log behind the scenes if the logdrain is enabled, and then parse it on Axiom side when recognized as JSON.

@schehata cant these text lines from the log drain be stringified JSON and then just parse them on Axiom side?

@kostas-pblworks we do have an internal issue to detect and parse json payloads (INP-57). will let you know when this is on production. please note that right now the next-axiom logs are enriched with request data that you'll be missing with console.log, unless you add it yourself.

This is has been released in the latest version, closing this now. Feel free to re-open if any issues related to this comes up.

Thank you @schehata , what exactly has been released? The vercel Log Drain can now parse structured JSON? Thank you

hi @kostas-pblworks , now when you log json using console.log() Axiom will parse it and store it as a structured log.
Now, next-axiom will recognize if vercel integration is enabled, and make use of the log drain, so it will use console.log() to send logs to the Log Drain instead of a direct http request to Axiom.

Now, next-axiom will recognize if vercel integration is enabled, and make use of the log drain, so it will use console.log() to send logs to the Log Drain instead of a direct http request to Axiom.

In light of the recent, rather blatant, pricing changes at Vercel, wouldn't it make more sense to send as much as possible directly to Axiom and as little as possible via log drains?