What's new

grep: /opt/var/log/dnsmasq.log: binary file matches

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

ColinJOnes

Occasional Visitor
Hi, I am trying to use the autoscan.sh script that comes x3mrouting and am getting an error. This is the command I am running but it doesn't work (It doesn't work when I search for anything).

Code:
./autoscan.sh autoscan=netflix

I do have these lines in the dnsmasq.conf.add file and the dnsmasq.log file does exists and it contains data

Code:
log-async
log-queries
log-facility=/opt/var/log/dnsmasq.log

If I run
Code:
cat /opt/var/log/dnsmasq.log |grep netflix --binary-files=text
I get lots of results back.

This used to work previously but recently started throwing up the error and was wondering if anybody had any ideas.

Code:
grep: /opt/var/log/dnsmasq.log: binary file matches


IPSET Format
-------------------------------------


grep: /opt/var/log/dnsmasq.log: binary file matches


FQDN Format
-------------------------------------

Thank you in advance.
 
Either clear the log file or search for binary character(s) in the file and remove it/them.
 
I posted as I didn't know how to clear the log file without deleting it and unfortunately I don’t know how to search for binary characters or even know what they are.

thanks for you help though. I resolved by stoping the service, deleting file and starting service again
 
Next time it happens, try this to keep the existing dnsmasq log file.
You'll need Entware grep installed which Diversion and maybe other scripts install by default.
If /opt/bin/grep is missing install it with
Code:
opkg install grep

Check if the log file contains NULL characters:
Code:
/opt/bin/grep -Pa '\x00' /opt/var/log/dnsmasq.log
If any are found, then you may remove them using:
Code:
tr < /opt/var/log/dnsmasq.log -d '\x00' > /opt/var/log/dnsmasq_cleared.log
Check if those pesky characters are gone in the temp file:
Code:
/opt/bin/grep -Pa '\x00' /opt/var/log/dnsmasq_cleared.log
If so, move it and restart Dnsmasq:
Code:
mv -f /opt/var/log/dnsmasq_cleared.log /opt/var/log/dnsmasq.log
service restart_dnsmasq
 
Similar threads
Thread starter Title Forum Replies Date
F Solved Compilation error /opt/bin/ld: cannot find Asuswrt-Merlin AddOns 1

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top