pdnslog ON RECURSOR SHOWS ON MULTIPLE LINES ON SYSLOG
Pius Nganga via Pdns-dev <[email protected]> Fri, 29 Jan 2021 06:36:27 +0300
| Newsgroups | gmane.network.dns.powerdns.devel |
|---|---|
| Message-ID | <CANtG0d9A-T09SpxLz4FVR8UyjGnNkn4E6deDDWmzHff7O91iYA@mail.gmail.com> |
--===============7342981571291467237==
Content-Type: multipart/alternative; boundary="0000000000003f6df805ba01b6be"
--0000000000003f6df805ba01b6be
Content-Type: text/plain; charset="UTF-8"
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?
N.B Kindly note that we have tried shortening the log but it still logs on
two lines
--0000000000003f6df805ba01b6be
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:comic sa=
ns ms,sans-serif;font-size:small;color:#000000">Hi,<br><br></div><div class=
=3D"gmail_default" style=3D"font-family:comic sans ms,sans-serif;font-size:=
small;color:#000000">We are using a lua script for filtering urls based on =
pre-set policies inside the preresolve() method of pdns recursor. We are do=
ing this by checking dq.remoteaddr:toString() and reading the policies for =
it from sqlite db then taking the necessary action( mark the query as eithe=
r blocked or safe.) Before returning the function, we are logging the resul=
t to syslog using pdnslog as follows;</div><div class=3D"gmail_default" sty=
le=3D"font-family:comic sans ms,sans-serif;font-size:small;color:#000000"><=
br></div><div class=3D"gmail_default" style=3D"font-family:comic sans ms,sa=
ns-serif;font-size:small;color:#000000">pdnslog('Network:'..dq.remo=
teaddr:toString()..'|device:'..device_mac..'|ip:'..device_i=
p..'|url:'..dq.qname:toString()..'|category:'..data..'|=
policy ID:'..row.policy_id..'|Status:Safe')</div><div class=3D"=
gmail_default" style=3D"font-family:comic sans ms,sans-serif;font-size:smal=
l;color:#000000"><br></div><div class=3D"gmail_default" style=3D"font-famil=
y:comic sans ms,sans-serif;font-size:small;color:#000000">The blocking part=
is working as expected, the challenge is that the above log shows as two l=
ines on syslog or journalctl as shown below;<br><br>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<br>Jan 29 01:25:35 ns pd=
ns_recursor[24914]: |ID:3|Status:Safe</div><div class=3D"gmail_default" sty=
le=3D"font-family:comic sans ms,sans-serif;font-size:small;color:#000000"><=
br></div><div class=3D"gmail_default" style=3D"font-family:comic sans ms,sa=
ns-serif;font-size:small;color:#000000"><br></div><div class=3D"gmail_defau=
lt" style=3D"font-family:comic sans ms,sans-serif;font-size:small;color:#00=
0000">Our intention is to have it log on one line as;</div><div class=3D"gm=
ail_default" style=3D"font-family:comic sans ms,sans-serif;font-size:small;=
color:#000000"><br></div><div class=3D"gmail_default" style=3D"font-family:=
comic sans ms,sans-serif;font-size:small;color:#000000">Jan 29 01:25:35 ns =
pdns_recursor[24914]: Network:105.162.6.128|dev:dd:ef:ca:d8:4e:74|ip:192.16=
8.100.4|url:www.google.com.|category:Search Engines|ID:3|Status:Safe</div><=
div class=3D"gmail_default" style=3D"font-family:comic sans ms,sans-serif;f=
ont-size:small;color:#000000"><br></div><div class=3D"gmail_default" style=
=3D"font-family:comic sans ms,sans-serif;font-size:small;color:#000000"><br=
></div><div class=3D"gmail_default" style=3D"font-family:comic sans ms,sans=
-serif;font-size:small;color:#000000">Any idea on how we can enforce pdnslo=
g to write on a single line?<br><br></div><div class=3D"gmail_default" styl=
e=3D"font-family:comic sans ms,sans-serif;font-size:small;color:#000000">N.=
B Kindly note that we have tried shortening the log but it still logs on tw=
o lines<br></div></div>
--0000000000003f6df805ba01b6be--
--===============7342981571291467237==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Pdns-dev mailing list
[email protected]
https://mailman.powerdns.com/mailman/listinfo/pdns-dev
--===============7342981571291467237==--