These are chat archives for CZ-NIC/knot-resolver

20th
Nov 2018
vstath
@vstath
Nov 20 2018 12:23
What are the options to do logging for debug? I only want to log source IP and record they requested. I saw Redis somewhere but it shows for cluster cache storage only. Is it possible to log just minimally for debugging?
Vladimír Čunát
@vcunat
Nov 20 2018 12:29
There is normal and --verbose mode, no other simple options.
BTW, redis support for cache was removed in 2.0.0.
vstath
@vstath
Nov 20 2018 12:32
@vcunat so what options are there for shared in-memory cache? --verbose shows a lot of data. Could I use Lua in order to print as a query comes in?
Vladimír Čunát
@vcunat
Nov 20 2018 12:33
You could.
For cache there's only one option - LMDB. It's shared if you point to the same directory.
If you want to avoid writing to drive, create it inside tmpfs.
vstath
@vstath
Nov 20 2018 12:39
Was Redis network path causing delays? Why was it removed? I understand that LMDB in local access is super fast but curious if networks shared memory was considered a bottleneck

You could use Lua

Any pointers on that? I haven't seen many examples and the ones I've seen are usually dependent on someone knowing the internals of knot-resolver. If you have any quick pointers it would help me to look into it (rather than have a huge wide scope to investigate)

Vladimír Čunát
@vcunat
Nov 20 2018 12:44
Cache: usage of cache in kresd has never been designed for this. All queries to it are synchronous and we don't really try to minimize them. Therefore even with a fast network for the cache it wasn't good.
vstath
@vstath
Nov 20 2018 12:47
is policy module a Lua script in reality? Could I modify that to do logging as and where I need? Sorry if this is a very noob question - I've only been using it for a day
Vladimír Čunát
@vcunat
Nov 20 2018 12:52
Well, I'm afraid there are only the internals. You can copy policy.pattern implementation. You want to always return nil (no action, try further policies), but before that you can "do anything" with the query. https://gitlab.labs.nic.cz/knot/knot-resolver/blob/master/modules/policy/policy.lua#L416
User docs for this is in https://knot-resolver.readthedocs.io/en/stable/modules.html#query-policies (for what policy.pattern is)
vstath
@vstath
Nov 20 2018 13:17
Thank you for the insight