[Pdns-dev] pdnslog ON RECURSOR SHOWS ON MULTIPLE LINES ON SYSLOG

Pius Nganga pnganga05 at gmail.com
Fri Jan 29 12:31:38 UTC 2021


Thanks Peter,

The 'data' variable had a new line at the end. We removed the new line and
it now works as expected.

On Fri, Jan 29, 2021 at 2:41 PM Peter van Dijk via Pdns-dev <
pdns-dev at mailman.powerdns.com> wrote:

> Hello,
>
> On Fri, 2021-01-29 at 06:36 +0300, Pius Nganga via Pdns-dev wrote:
> > Hi,
> >
> > We are using a lua script for filtering urls based on pre-set policies
> inside the preresolve() method of pdns recursor. We are doing this by
> checking dq.remoteaddr:toString() and reading the policies for it from
> sqlite db then taking the necessary action( mark the query as either
> blocked or safe.) Before returning the function, we are logging the result
> to syslog using pdnslog as follows;
> >
> >
> pdnslog('Network:'..dq.remoteaddr:toString()..'|device:'..device_mac..'|ip:'..device_ip..'|url:'..dq.qname:toString()..'|category:'..data..'|policy
> ID:'..row.policy_id..'|Status:Safe')
> >
> > The blocking part is working as expected, the challenge is that the
> above log shows as two lines on syslog or journalctl as shown below;
> >
> > Jan 29 01:25:35 ns pdns_recursor[24914]:
> Network:105.162.6.128|device:dd:ef:ca:d8:4e:74|ip:192.168.100.4|url:www.google.com.|category:Search
> Engines
> > Jan 29 01:25:35 ns pdns_recursor[24914]: |ID:3|Status:Safe
> >
> >
> > Our intention is to have it log on one line as;
> >
> > Jan 29 01:25:35 ns pdns_recursor[24914]:
> Network:105.162.6.128|dev:dd:ef:ca:d8:4e:74|ip:192.168.100.4|url:www.google.com.|category:Search
> Engines|ID:3|Status:Safe
> >
> >
> > Any idea on how we can enforce pdnslog to write on a single line?
>
> I suspect your 'data' variable ends in a new line. You'll have to remove
> that new line from it.
>
> Kind regards,
> --
> Peter van Dijk
> PowerDNS.COM BV - https://www.powerdns.com/
>
> _______________________________________________
> Pdns-dev mailing list
> Pdns-dev at mailman.powerdns.com
> https://mailman.powerdns.com/mailman/listinfo/pdns-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-dev/attachments/20210129/aa1b03fa/attachment.htm>


More information about the Pdns-dev mailing list