A dedicated log file for kresd?

I’m seeing kresd logging to /var/log/messages.

I’d like to give it a dedicated logfile that rotates and am wondering how. Here is my current config:

# cat /etc/config/resolver

config resolver 'common'
	list interface '0.0.0.0'
	list interface '::0'
	option port '53'
	option keyfile '/etc/root.keys'
	option verbose '0'
	option msg_buffer_size '4096'
	option msg_cache_size '20M'
	option net_ipv6 '1'
	option net_ipv4 '1'
	option forward_upstream '1'
	option prefered_resolver 'kresd'
	option ignore_root_key '0'
	option prefetch 'yes'
	option static_domains '1'
	option dynamic_domains '1'

config resolver 'kresd'
	option rundir '/tmp/kresd'
	option log_stderr '1'
	option log_stdout '1'
	option forks '1'
	option keep_cache '0'
	list hostname_config '/etc/hosts'

config resolver 'unbound'
	option outgoing_range '60'
	option outgoing_num_tcp '1'
	option incoming_num_tcp '1'
	option msg_cache_slabs '1'
	option num_queries_per_thread '30'
	option rrset_cache_size '100K'
	option rrset_cache_slabs '1'
	option infra_cache_slabs '1'
	option infra_cache_numhosts '200'
	list access_control '0.0.0.0/0 allow'
	list access_control '::0/0 allow'
	option pidfile '/var/run/unbound.pid'
	option root_hints '/etc/unbound/named.cache'
	option target_fetch_policy '2 1 0 0 0'
	option harden_short_bufsize 'yes'
	option harden_large_queries 'yes'
	option qname_minimisation 'yes'
	option harden_below_nxdomain 'yes'
	option key_cache_size '100k'
	option key_cache_slabs '1'
	option neg_cache_size '10k'
	option prefetch_key 'yes'

config resolver 'unbound_remote_control'
	option control_enable 'yes'
	option control_use_cert 'no'
	list control_interface '127.0.0.1'

Is there a way to configure kresd to use it’s own log file (like say /var/log/kresd and not write to messages?

I’m not aware of such a possibility. (on Turris; elsewhere people often have journalctl or something else that cares for such stuff)

Rather unfortunate as we don’t have systemd and journalctl on the Omnia. Might be nice if kresd had such a configuration added, for those who don’t have tools like journalctl and see huge messages files when verbose logging is on and have difficult extracting kresd messages from the background noise in messages (yeah I know grep, tail etc, but it’s a large file)…

But you have the same problem with all services on Turris. I believe it’s generally better to outsource logging into a system-wide solution.

You could probably achieve this by adding some custom config to /etc/syslog-ng.d/

see https://www.syslog-ng.com/technical-documents/list/syslog-ng-open-source-edition/3.30

Thanks. Some stuff to read there. Am currently looking at rotating /var/log/messages (which hasn’t been), and mimicing a config here:

Yep, looks like syslog-ng can do this easily!

http://www.softpanorama.org/Logs/Syslog_ng/configuration_examples.shtml

Will implement this soon methinks. Looks a lot like (untested just hypothesised tonight):

source src { unix-stream("/dev/log"); internal(); };
destination kresd_log { file("/var/log/kresd.log"); };
filter kresd_filter { program(kresd); };
log { source(src); filter(kresd_filter); destination(kreds_log); };

If this or something like it works, I’ll drop a line here later. Because that is so cool it’s worth having on record, and more widely known.