Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jul 2017 20:02:30 +0200
From:      Matthias Fechner <idefix@fechner.net>
To:        freebsd-ports@freebsd.org
Subject:   Re: Best practice to tail a log and start it as service using rc.d scripts
Message-ID:  <34946b34-5e91-031f-b1dc-146c3ded4803@fechner.net>
In-Reply-To: <595A8B47.2060705@grosbein.net>
References:  <62c231e8-74b0-8515-eb22-4e4edf6ff5e2@fechner.net> <595A8B47.2060705@grosbein.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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.


Thanks
Matthias

-- 

"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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34946b34-5e91-031f-b1dc-146c3ded4803>