Page MenuHomeFreeBSD

Add a new 'include' keyword to syslog.conf
ClosedPublic

Authored by bapt on Oct 31 2016, 8:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 2:06 AM
Unknown Object (File)
Mar 29 2024, 10:35 AM
Unknown Object (File)
Mar 28 2024, 4:28 PM
Unknown Object (File)
Mar 28 2024, 3:26 PM
Unknown Object (File)
Feb 19 2024, 7:48 AM
Unknown Object (File)
Feb 3 2024, 12:08 PM
Unknown Object (File)
Feb 2 2024, 11:38 AM
Unknown Object (File)
Jan 8 2024, 4:06 AM

Details

Summary

the include keyword is looking at non hidden '.conf' files in the directory
specified in argument.

If the directory does not exist it is simply ignored

It simplies usage of syslogd with automation tools as well as allowing packages
to provide samples syslog configuration files

Change the default config to look for configuration files in /etc/syslog.d and
/usr/local/etc/syslog.d

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5779
Build 6083: arc lint + arc unit

Event Timeline

bapt retitled this revision from to Add a new 'include' keyword to syslog.conf.
bapt updated this object.
bapt edited the test plan for this revision. (Show Details)
bapt edited edge metadata.

Add /etc/syslog.d in mtree

bapt edited edge metadata.

Ensure 'include' is followed by a space to be taken in account (reported by kib)
Fix some debug printing

bapt edited edge metadata.

Use static string and sizeof as requested by kib

bapt edited edge metadata.

more sizeof

bapt edited edge metadata.

Check the return of snprintf

bapt edited edge metadata.

Test the result of scandir(3) and print it in debug output

usr.sbin/syslogd/syslog.conf.5
67

maybe "all files with names ending in '.conf' and not beginning with a '.' contained in the directory following the keyword."?

usr.sbin/syslogd/syslogd.c
1663

Why not do this check in the select routine for scandir too?

1678

This will crash if a config file includes the directory it's in.

bapt edited edge metadata.

Reword manpage
Prevent 'include' recursion
Move then entire configfile detection into the select for scandir

bapt marked 3 inline comments as done.Nov 1 2016, 12:34 AM
bapt edited edge metadata.

Plig memory leak

markj added a reviewer: markj.
markj added inline comments.
usr.sbin/syslogd/syslogd.c
1659

This works, but the restriction should be noted in the syslog.conf man page. I think newsyslog is more complete and actually detects include cycles.

1692

You can add a "continue" to the nents == -1 case above to avoid the conditional here.

This revision is now accepted and ready to land.Nov 1 2016, 1:24 AM
This revision was automatically updated to reflect the committed changes.
wblock added inline comments.
usr.sbin/syslogd/syslog.conf.5
67

Sorry for the late response. This explanation is still not that clear. Suggestion below. Also, this really needs an example in the man page.

The
.Em include 
keyword includes all files with names ending in
.Pa .conf
from the directory name following the keyword.
Filenames that begin with a single dot
.Pa \&. 
are ignored.