newrelic drain posts to the New Relic Log API for your region. Each batch becomes one payload in the API’s detailed form: the agent’s identity once in common.attributes, and every record as one entry in logs[] with the platform’s lua.* keys and the record’s own attributes beside them.
Vendor destinations are opened per deployment. Where
newrelic is not open yet, a create answers 422 DRAIN_TYPE_UNAVAILABLE and the message names the types that are. It may not be enabled on your deployment yet.- A New Relic licence key (an ingest key). Not a user key and not an API key.
- The region your New Relic account is in.
What to enter
--endpoint is not accepted for this type. The intake URL is derived from the site, so no drain configuration can point a batch carrying your licence key at a host of anyone’s choosing:
Only those three hosts are allowed. Anything else is refused when the drain is created.
How ownership verification works
202. A 403 means the licence key is wrong or belongs to another region — a US key against log-api.eu.newrelic.com fails exactly this way. Verification is limited to 5 attempts per drain per hour.
New Relic deliveries are not signed.
What arrives
The detailed form is used because a batch already shares one identity — the flush groups by agent, environment, and agent version — so the resource belongs in
common exactly once instead of repeated on all 500 logs. That is the difference between fitting the request and not.
Useful queries
Caps
New Relic’s megabyte is decimal. Its request limit is 1,000,000 bytes — 10⁶, not 2²⁰. Reading it as a mebibyte would put every full batch 4.9% over the limit, which is why the batch cap is 750,000 bytes rather than 768 KiB like the other presets.
Two truncations the encoder applies first
New Relic enforces both of these itself, silently. Lua applies them before sending, so what you see in New Relic matches what the drain’s delivery row says it sent.- 4,094 characters per attribute value, and per
message. A longer value is cut to that length. No marker is appended — the value simply ends. - 255 attributes per log. Beyond it New Relic drops attributes and does not say which. Lua fills the budget in a fixed order, so the outcome is deterministic and a retry re-encodes identically: the six
lua.*keys the encoder adds, then every attribute the platform authored —lua.*,gen_ai.*,exception.*,user.id, whatever their prefix — in sorted key order, and only then theapp.*fields your own code supplied, also sorted. So what a record over the ceiling loses is your own fields, alphabetically last, and never a platform attribute you were already querying. Onelog.*call adds at most 33 attributes — its 32-key budget already counts any companionapp.<key>.count, plusapp.lua_fields_clampedwhen a value was clamped — which leaves the ceiling comfortable, but it is the side that gives way.
Test the key with curl
202 {"requestId":"…"} means accepted. 403 means the key is wrong for that region. Then:
If it isn’t working
403 on every delivery
403 on every delivery
Either the header is not
Api-Key, or the licence key belongs to a different region. Keys are per-account and per-region: a key from a US account is refused by log-api.eu.newrelic.com. Recreate the drain with the right --site, or update the value with lua drains update <id> --header Api-Key.202 but nothing appears in New Relic
202 but nothing appears in New Relic
A
202 means accepted for processing, not indexed. Check the timestamp first: New Relic may discard an event older than 48 hours, which is what a resumed long-paused drain produces.Some attributes are missing on busy records
Some attributes are missing on busy records
The 255-attribute ceiling. Platform attributes are kept first; your own
app.* fields fill the remainder in sorted key order, so what is lost is alphabetically last among your fields. Send fewer fields on the noisiest lines, narrow --sources, or use a destination without the ceiling — object storage keeps every attribute.Long messages end abruptly with no ellipsis
Long messages end abruptly with no ellipsis
That is the 4,094-character cut, applied with no marker because New Relic itself appends none. The full body is still in
lua logs and in any other drain on the same records.Next steps
Event schema
What every
lua.* attribute means.Protecting your destination
What verification does and does not prove.
Delivery guarantees
Retry, drops, heartbeat, and health states.
lua drains
Every verb and flag.

