[Pdns-users] Auth and Recursor dedicated logging only

Giovanni Vecchi g.vecchi at certego.net
Fri Apr 10 14:08:14 UTC 2020


Hi guys,

problem solved.
In my past configuration, syslog logging was enabled in order to create a
dedicated logging file for both auth and recursor; the problem was that
stdout collected by systemd journal was then copied to default syslog file
in addition of dedicated ones and the result was that */var/log/syslog* was
flooded by a copy of the same messages (loglevel is set to maximum value
for both auth and recursor for business reasons).
So, I decided to handle logging directly with systemd journal and rsyslog
filter in this way:

- both auth and recursor are installed on the same Ubuntu 18.04 server
- using default systemd unit file for both auth and recursor
- by default, rsyslog put every syslog facility message in */var/log/syslog*,
see */etc/rsyslog.d/50-default.conf*

...
*.*;auth,authpriv.none          -/var/log/syslog
...

- I created */etc/rsyslog.d/00-pdns-auth.conf *




*:programname, isequal, "pdns_server"      -/var/log/pdns/auth.log
:programname, isequal, "pdns_server"      ~:programname, isequal, "pdns"
   -/var/log/pdns/auth.log :programname, isequal, "pdns"      ~*

and */etc/rsyslog.d/00-pdns-rec.conf*


*:programname, isequal, "pdns_recursor"      -/var/log/pdns/rec.log
:programname, isequal, "pdns_recursor"      ~*

- at the end of */etc/logrotate.d/rsyslog*, I added:

*...*












*/var/log/pdns/auth.log/var/log/pdns/rec.log{        rotate 7        daily
      missingok        notifempty        delaycompress        compress
  postrotate                /usr/lib/rsyslog/rsyslog-rotate
endscript}*

- rsyslog restart and job done!

@Otto: as per documentation, setting *--daemon* and *--disable-syslog* seem
to break logging, isn't it?.

Any further advice is welcome!

Thanks to everyone!

On Fri, 10 Apr 2020 at 09:19, Otto Moerbeek <otto at drijf.net> wrote:

> On Thu, Apr 09, 2020 at 09:23:09PM +0200, Klaus Darilion wrote:
>
> > My systemd service file has:
> >
> > ExecStart=/usr/sbin/pdns_server --config-name=%i --guardian=no
> --daemon=no --disable-syslog --log-timestamp=no --write-pid=no
> >
> > I can't remember if --disable-syslog is default or added by me.
>
> That's the default. systemd runs daemons in the non-classical way,
> they log to stdout and syslogd picks that up.
>
>         -Otto
>
> >
> > regards
> > Klaus
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Pdns-users <pdns-users-bounces at mailman.powerdns.com> Im Auftrag
> > > von Otto Moerbeek via Pdns-users
> > > Gesendet: Donnerstag, 9. April 2020 19:47
> > > An: Giovanni Vecchi <g.vecchi at certego.net>
> > > Cc: pdns-users at mailman.powerdns.com
> > > Betreff: Re: [Pdns-users] Auth and Recursor dedicated logging only
> > >
> > > On Thu, Apr 09, 2020 at 06:52:23PM +0200, Giovanni Vecchi via
> Pdns-users
> > > wrote:
> > >
> > > > Hi guys,
> > > >
> > > > how to configure both auth and recursor to log only on syslog
> facility (and
> > > > not on stdout)?
> > > > From docu it seems that syslog logging is an addition only.
> > >
> > > daemon=yes stops the logging to stdout.
> > >
> > >     -Otto
> > > _______________________________________________
> > > Pdns-users mailing list
> > > Pdns-users at mailman.powerdns.com
> > > https://mailman.powerdns.com/mailman/listinfo/pdns-users
>


-- 

 <http://www.certego.net/>
Giovanni Vecchi
Infrastructure Lead Engineer, Certego
+39-059-7353333
 <http://www.linkedin.com/company/certego>
<http://twitter.com/Certego_IRT>  <http://github.com/certego>
<http://www.youtube.com/CERTEGOsrl>
<http://plus.google.com/117641917176532015312>
Use of the information within this document constitutes acceptance for
use in an "as is" condition. There are no warranties with regard to
this information; Certego has verified the data as thoroughly as
possible. Any use of this information lies within the user's
responsibility. In no event shall Certego be liable for any
consequences or damages, including direct, indirect, incidental,
consequential, loss of business profits or special damages, arising
out of or in connection with the use or spread of this information.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20200410/5022cb11/attachment.htm>


More information about the Pdns-users mailing list