Getting service name into nginx

hello fly friends,

I’m centralizing my logging using papertrail, and I’ve found that the instance ids/hashes or whatever are a little hard to track to an application. I’m seeing events happening that could be occurring in a number of services and having a hard time figuring out which one.

Is there a way for me to get the service name into Nginx so that my logging can include it?

Separately, is there a technique I’m missing to map from an instance to a service? Was not obvious if there was a way to do that on the site or via the CLI.

Thank you!

hey folks. So after I asked this I think I found what I need to do this. So to save you time, I just wanted to give a heads-up. I’ll circle back if I’m wrong and still need help. And once I’m sure I’ll put my solution here.

1 Like

Can you use the FLY_APP_NAME environment variable?


If you didn’t figure it out yet, FLY_APP_NAME env var will work. nginx is a pain with env vars, so you may want to run your nginx.conf through envsubst at boot time.

1 Like

Thank you! This is the plan. Haven’t had a chance to change the config yet, but hoping this will do it.