i am trying to setup a powerdns recursor with query logging to specific log file with rsyslog. When I set it up and try to query some address and look in the query log file, every line is doubled, it also happens in the journal. I don't know what to do can somebody help me?

This is my configuration files summarized:

/etc/pdns-recursor/recursor.conf -

allow-from=192.168.4.0/24
forward-zones-recurse=.=8.8.8.8
local-address=192.168.4.102
log-timestamp=no
logging-facility=0
loglevel=5
quiet=no
security-poll-suffix=
setgid=pdns-recursor
setuid=pdns-recursor

/etc/rsyslog.conf -

/etc/rsyslog.conf section 2

in /usr/lib/systemd/system/pdns-recursor.service set execstart to:

ExecStart=/usr/sbin/pdns_recursor --daemon=no --write-pid=no --disable-syslog=no --log-timestamp=no

You are logging everything twice because logging is configured twice.

In particular, the PowerDNS unit by default doesn't log to syslog:

Additionally, the Recursor can log to syslog on these systems. Logging to syslog is disabled in the unit file to prevent double logging

Source: https://doc.powerdns.com/recursor/running.html

whereas you set --disable-syslog=no, which means it's enabled.

Disable syslog at the unit level and restart the service.