Add custom attribute to a log based on its source

Is it possible to set custom attributes to a Log based on its source? Similar to how Sumologic allows a collection to add custom attributes. The issue is the logs coming out of the Heroku log drain. When having multiple sources, they need separate attributes for application and environment. The procid provided by Heroku is not enough, since that is using the standard configurations of web or worker.

Hi @michael.guymon
Yes! If you can pass the custom attributes as key-value pairs along with your JSON payload, they will be stored and can be queried later. More details on the information that can be passed to New Relic Logs end point can be found here.

Hope it helps!

Is there any way to search or filter by the drain token? According to Heroku, it is written into the log messages. But I don’t see it in any of the attributes in New Relic.

Hello @rex3 , we have a docs page for Heroku logs ingest which revolves around drain tokens: Stream logs from Heroku | New Relic Documentation

It looks like you can specifically add ingest Heroku logs per drain token. Let us know if there is more to the use case which isn’t covered by this process!