<div dir="ltr"><div class="gmail_default" style="font-family:comic sans ms,sans-serif;font-size:small;color:#000000">Thanks Peter,<br><br></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif;font-size:small;color:#000000">The 'data' variable had a new line at the end. We removed the new line and it now works as expected.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 29, 2021 at 2:41 PM Peter van Dijk via Pdns-dev <<a href="mailto:pdns-dev@mailman.powerdns.com">pdns-dev@mailman.powerdns.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
On Fri, 2021-01-29 at 06:36 +0300, Pius Nganga via Pdns-dev wrote:<br>
> Hi,<br>
> <br>
> 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;<br>
> <br>
> pdnslog('Network:'..dq.remoteaddr:toString()..'|device:'..device_mac..'|ip:'..device_ip..'|url:'..dq.qname:toString()..'|category:'..data..'|policy ID:'..row.policy_id..'|Status:Safe')<br>
> <br>
> 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;<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 pdns_recursor[24914]: |ID:3|Status:Safe<br>
> <br>
> <br>
> Our intention is to have it log on one line as;<br>
> <br>
> 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<br>
> <br>
> <br>
> Any idea on how we can enforce pdnslog to write on a single line?<br>
<br>
I suspect your 'data' variable ends in a new line. You'll have to remove that new line from it.<br>
<br>
Kind regards,<br>
-- <br>
Peter van Dijk<br>
PowerDNS.COM BV - <a href="https://www.powerdns.com/" rel="noreferrer" target="_blank">https://www.powerdns.com/</a><br>
<br>
_______________________________________________<br>
Pdns-dev mailing list<br>
<a href="mailto:Pdns-dev@mailman.powerdns.com" target="_blank">Pdns-dev@mailman.powerdns.com</a><br>
<a href="https://mailman.powerdns.com/mailman/listinfo/pdns-dev" rel="noreferrer" target="_blank">https://mailman.powerdns.com/mailman/listinfo/pdns-dev</a><br>
</blockquote></div>