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

Generate syslog tags based on the name of the executable or link. #362

Merged
merged 1 commit into from
Oct 19, 2016

Conversation

ColinSullivan1
Copy link
Member

@ColinSullivan1 ColinSullivan1 commented Oct 18, 2016

When running multiple NATS servers on a machine and directing output to syslog, we need a way to differentiate the servers beyond process ID. One way to do this is to use the link or executable name used to launch the process. Users can then identify individual servers in the syslog output if they link to, or copy the NATS server. Current behavior will be maintained when using the default NATS server executable.

Given files gnatsd, a copy of gnatsd (gnatsd.1) and a link gnatsd-link:

-rwxr-xr-x  1 colinsullivan  staff  9084636 Oct 18 11:35 gnatsd
lrwxr-xr-x  1 colinsullivan  staff       10 Oct 18 11:38 gnatsd-link -> ./gnatsd
-rwxr-xr-x  1 colinsullivan  staff  9084636 Oct 18 11:36 gnatsd.1

The NATS server will generate syslog statements based on the link or executable name stripped of the path, demonstrated below. The command used is paired with a corresponding syslog statement.

# ../tmp/gnatsd -s udp://localhost:512
Oct 18 11:50:15 machinename gnatsd[92147] <Notice>: Starting nats-server version 0.9.4

# ./gnatsd.1 -s udp://localhost:512
Oct 18 11:50:38 machinename gnatsd.1[92173] <Notice>: Starting nats-server version 0.9.4

# ./gnatsd-link -s udp://localhost:512
Oct 18 11:51:28 machinename gnatsd-link[92188] <Notice>: Starting nats-server version 0.9.4

# gnatsd -s udp://localhost:512
Oct 18 11:52:26 machinename gnatsd[92296] <Notice>: Starting nats-server version 0.9.4

Note: An alternative is a command line parameter / server option.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) to 89.837% when pulling c3753d4 on syslog-tag into 8da901f on master.

@derekcollison derekcollison merged commit 10cd7aa into master Oct 19, 2016
@derekcollison derekcollison deleted the syslog-tag branch October 19, 2016 14:52
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

Successfully merging this pull request may close these issues.

3 participants