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

Few changes to get syslog really working #7

Merged
merged 3 commits into from Oct 13, 2015
Merged

Conversation

tailhook
Copy link
Contributor

  1. Implemented sane init() function for logging
  2. Add FromStr for facility, so it can be used for argument parsing and other things
  3. Remove localhost hostname from the syslog entry. By specification it seems that "relay" may add it if not exists. And it reality both journalctl (systemd) and ubuntu rsyslogd add additional hostname if "localhost" is specified. The journalctl also add additional identifier/application name of executable, so I can't even search in logs by --identifier.

This function is superior in two aspects:

1. It detects whether Unix or TCP socket should be used
2. Allows to customize syslog's application name
@tailhook
Copy link
Contributor Author

I can split pull request if you like. Commits are pretty isolated, I'm just lazy to provide multiple pull requests (i.e. doing many cherry-picks/rebases)

Geal added a commit that referenced this pull request Oct 13, 2015
Few changes to get syslog really working
@Geal Geal merged commit a3a8165 into Geal:master Oct 13, 2015
@Geal
Copy link
Owner

Geal commented Oct 13, 2015

Alright, thanks!

gkurz added a commit to gkurz/rust-syslog that referenced this pull request Jan 15, 2024
The UNIX socket specific initialization functions `init_unix()` and
`init_unix_custom()` take care of not setting the hostname in the
header. This is based on the assumption that a syslog relay will
set the appropriate hostname (see PR Geal#7).

The generic initialization function `init()` that supports UNIX, UDP
and TCP sockets does set the hostname unconditionally though. Users
of this API end up with an extra hostname being added to their logs,
as seen with virtiofsd for example :

Jan 12 17:03:04 myhostname virtiofsd[70727]: myhostname virtiofsd[70725]: Waiting for vhost-user socket connection...

Only set the hostname for UDP and TCP.

Signed-off-by: Greg Kurz <groug@kaod.org>
gkurz added a commit to gkurz/rust-syslog that referenced this pull request Jan 15, 2024
The UNIX socket specific initialization functions `init_unix()` and
`init_unix_custom()` take care of not setting the hostname in the
header. This is based on the assumption that a syslog relay will
set the appropriate hostname (see PR Geal#7).

The generic initialization function `init()` that supports UNIX, UDP
and TCP sockets does set the hostname unconditionally though. Users
of this API end up with an extra hostname being added to their logs,
as seen with virtiofsd for example :

Jan 12 17:03:04 myhostname virtiofsd[70727]: myhostname virtiofsd[70725]: Waiting for vhost-user socket connection...

Use a distinct `Format3164` structure for each case and only set
the hostname for UDP and TCP.

Signed-off-by: Greg Kurz <groug@kaod.org>
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.

None yet

2 participants