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@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/pdns-dev

Reply via email to