From owner-freebsd-ports@freebsd.org Tue Jul 4 18:02:42 2017 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD539D97317 for ; Tue, 4 Jul 2017 18:02:42 +0000 (UTC) (envelope-from idefix@fechner.net) Received: from anny.lostinspace.de (anny.lostinspace.de [195.30.95.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F63B82D64 for ; Tue, 4 Jul 2017 18:02:42 +0000 (UTC) (envelope-from idefix@fechner.net) Received: from server.idefix.lan (aftr-185-17-205-180.dynamic.mnet-online.de [185.17.205.180]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: idefix@fechner.net) by anny.lostinspace.de (Postfix) with ESMTPSA id D9811C2E529 for ; Tue, 4 Jul 2017 20:02:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fechner.net; s=default; t=1499191352; bh=aIV0Q9Ze9rqUNfa7BoW5lx7J5Mj5fJpQyFBD/KbyB6s=; h=Subject:To:References:From:Date:In-Reply-To; b=YPL6KY/Vmu/n8/D4BHjRcLjdCVEJCFEg5C1DI9aS1IWFr8wnQIVtNttUtcY9caijp NAr4r3qgv0z/mhg7MW/qZZmJBYy12QOWzXtD6v2QydxIvl0XnfseygyArx4K0gzNYP o1gMTV4WZTzkHxeau5lHjYpt+ZvJOsu1m/xsiDnw= Received: from [192.168.0.151] (aftr-185-17-205-180.dynamic.mnet-online.de [185.17.205.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by server.idefix.lan (Postfix) with ESMTPSA id 6F505D015D9 for ; Tue, 4 Jul 2017 20:02:32 +0200 (CEST) Subject: Re: Best practice to tail a log and start it as service using rc.d scripts To: freebsd-ports@freebsd.org References: <62c231e8-74b0-8515-eb22-4e4edf6ff5e2@fechner.net> <595A8B47.2060705@grosbein.net> From: Matthias Fechner Message-ID: <34946b34-5e91-031f-b1dc-146c3ded4803@fechner.net> Date: Tue, 4 Jul 2017 20:02:30 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <595A8B47.2060705@grosbein.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2017 18:02:42 -0000 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