Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log the answers and post-processing #16

Open
skon77 opened this issue Oct 11, 2022 · 0 comments
Open

Log the answers and post-processing #16

skon77 opened this issue Oct 11, 2022 · 0 comments

Comments

@skon77
Copy link

skon77 commented Oct 11, 2022

Hi,

Thank you so much for such a great library.

In DNS.J library comments there is this setting (2):
0: No decoding, minimal processing required to strip packet from HTTP wrapper (fastest)
1: Parse DNS Header and Question. We can log the Question, Class, Type, and Result Code
2: As 1, but also parse answers. We can log the answers, and also cache responses in HTTP Content-Cache
3: Very Verbose, log everything as above, but also write packet data to error log (slowest)

Can you give me an example of getting a this answer? To write in access_log not only $dns_qname but also the answer.
Something like this:
www.baidu.com IN A DNS Answer: www.baidu.com 782 IN CNAME www.a.shifen.com; www.a.shifen.com 103 IN A 61.135.169.125; www.a.shifen.com 103 IN A 61.135.169.121;

And second question about nginx javascript.
Is there any way to make a shell command call from the nginx.conf file?
There is a need to transfer DNS answer IP to my router via SSH channel. The script itself is there and it works. Selected IP addresses are immediately added to the corresponding Address Lists of my Mikrotik with control commands. The only question is how to pass IP itself from nginx.conf and make SSH call. On the forums mostly suggest Lua for this purpose.

At the moment I can selectively log the domains I want. In the Address Lists of my Mikrotik, I can either forward IPs or domains. But IP is more preferable for me.

log_format dns '$dns_qname';
access_log /var/log/nginx/dns-access.log dns if=$logme;

map $dns_qname $logme {
hostnames;
*.cdninstagram.com 1;
default 0;
}

And I can create some daemon to track changes in the log file with further SSH call. But I want a more elegant solution.

Thanx!

@skon77 skon77 changed the title Log the answers Log the answers and post-processing Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant