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)
Wed, Jan 1, 11:30 PM
Unknown Object (File)
Dec 4 2024, 4:10 AM
Unknown Object (File)
Dec 3 2024, 9:00 PM
Unknown Object (File)
Nov 24 2024, 3:16 AM
Unknown Object (File)
Nov 22 2024, 7:30 AM
Unknown Object (File)
Nov 22 2024, 2:08 AM
Unknown Object (File)
Nov 21 2024, 11:29 AM
Unknown Object (File)
Nov 17 2024, 7:51 PM

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 5771
Build 6075: 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
1662

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

1677

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
1658

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.

1691

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.