Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic application names #10

Closed
walrusVision opened this issue Jun 14, 2017 · 3 comments
Closed

Dynamic application names #10

walrusVision opened this issue Jun 14, 2017 · 3 comments

Comments

@walrusVision
Copy link
Contributor

A useful feature in syslog would be the ability to have more control over the application name when sending messages.

For example if I had the apps foo, bar and baz I'd like to get log messages like this

Jun 13 17:00:00 my_host foo[1111]: A message from the app foo
Jun 13 17:00:00 my_host bar[1111]: A message from the app bar
Jun 13 17:00:00 my_host baz[1111]: A message from the app baz

as opposed to this

Jun 13 17:00:00 my_host foo[1111]: A message from the app foo
Jun 13 17:00:00 my_host foo[1111]: A message from the app bar
Jun 13 17:00:00 my_host foo[1111]: A message from the app baz

The current behavior is to have the name set via either the env var, node name or beam. The specific use case we'd use it for is when we want each app in a release to log with their own name rather than a single name. This makes it easier to track where errors are happening in code, especially since we also forward WARNING messages and above to our monitoring tools.

@schlagert
Copy link
Owner

That's an interesting use case and I would love to support it. However I can't really come up with another solution than expanding the syslog:msg/X API to overwrite the application name.

Do you use the RFC 5424 formatter? Because if you do, you could consider using STRUCTURED DATA for this, I just recently added support for it. You could then either use the alarm id (see IANA) or define your own id with a custom set of parameters.

Tell me what you think about it.

@walrusVision
Copy link
Contributor Author

Hi @schlagert thanks for having a look. I also couldn't come up with a different ideas as well, when I was looking through the code.

I did have a look at the STRUCTURED DATA since I'm using syslog-ng which can listen for RFC5424 messages. According to this documentation the PROGRAM name part of the message can be adjusted so that might do what I want get the logging how I want it.

Since I'm using lager and it's parse transform packs the application name into metadata, a minor modification to the backend would allow the application name to be packed in automatically to the STRUCTURED DATA as well.

I didn't know about alarm! I'll definitely look at that.

@walrusVision
Copy link
Contributor Author

The packing the application name into the STRUCTURED DATA and then getting syslog-ng to rewrite the PROGRAM name worked perfectly thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants