Created
October 4, 2019 18:05
-
-
Save egeneralov/8fa37fdd5e4ad8baf69d68560bada9a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -xe | |
| cat << EOF > /etc/systemd/system/log-dns-query.service | |
| [Unit] | |
| Description=dns | |
| [Service] | |
| ExecStart=/bin/sh -c "script -q -c \"tcpdump -l port 53 2>/dev/null | grep --line-buffered ' A? ' | cut -d' ' -f8\" | tee -a /var/log/dns.log" | |
| [Install] | |
| WantedBy=multi-user.target | |
| EOF | |
| systemctl daemon-reload | |
| systemctl restart log-dns-query.service | |
| journalctl -u log-dns-query.service -f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment