Best practice to tail a log and start it as service using rc.d scripts

Matthias Fechner idefix at
Tue Jul 4 18:02:42 UTC 2017

Am 03.07.2017 um 20:21 schrieb Eugene Grosbein:
> For logs written using standard syslog service, there is much
> effective way.
> 1. The syslogd daemon can run a subprocess and duplicate log stream to its
> standard input. For example, write to its config:
> mail.*	"|exec nc localhost 5699 -"
> See man syslog.conf for details. You can even pipe not full log
> but some part of it, f.e. `mail.notice' instead of `mail.*'
> for important event only (no debug lines, no informational mesages).
thanks for this, I will test that more in detail.
I correctly have the problem if the mailtrain app is stopped, it closes
the network socket which causes nc to terminate.
This is not what I would like to have, but maybe syslog is restarting nc
in this case?

If not syslog is maybe not the right solution, but I will test this first.

> 2. And you need not modify system /etc/syslog.conf but create file
> named like /usr/local/etc/syslog.d/mailtrain.conf with that single line.
> Then use `service syslogd reload' to apply additional configuration
> and syslogd will run your "addon" when corresponding logs is updated.

are you sure about this?
I cannot find that described in any man page, /etc/defaults/rc.conf neither.
I tested it but it is not working.
Just added a file: /usr/local/etc/syslog.d/mailtrain.conf with content:
mail.*  /var/log/maillog.err

I touched the /var/log/maillog.err and reloaded syslogd.
But nothing appears in that file.



"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

More information about the freebsd-ports mailing list