Partitioning logs from multiple distinct Heroku apps

I’m setting up log drains from Heroku to NR Logs, hoping to partition them by drain. It doesn’t look like anything about the particular drain makes it into the logged object, though, and what is there isn’t helpful for partitioning by app or drain:

Besides renaming all of my app processes to include the app name as a prefix (i.e. “appname_worker_run”, instead of “worker_run”), has anyone else solved this?

Ahhh, I just realized that renaming the processes won’t help for all of the Heroku-originated lines (i.e. from the router, or from heroku-postgres, etc).

If I’ve got separate apps sending logs in via distinct drains, I feel like this should be a simple thing somewhere, to hinge on drain source and thereby partition. Thoughts/ideas?

Also facing this issue. I can’t separate out logs based on which heroku app they come from - this seems like a trivial thing?

I am also facing this same issue. I don’t see anything to partition because it doesn’t seem like the drain ID or anything makes it into NR.

did anyone figure out a way to do this? Maybe passing some custom (app-specific) identifier along with the logs?

We are also hitting this issue, and it’s a HUGE problem for us – lack of ability to separate apps makes the logging pretty much useless.

Hello Everyone,

I will submit this as a feature request. Currently there is not an easy way to accomplish this task. New Relic drops the drain token from the message and this makes it difficult to tie a drain to an application.

It might be possible to find a work around but I have not been able to get it to work. Some resources to help you would be the following:

Dyno Metadata

The goal here is to tack on the Metadata exported as variables to the syslog message. Here is a source using Express Middleware: Express Heroku Metadata

As I said, I will submit this as a feature request. I hope this helps.