Bug 4196 - Setting logfile does nothing.
Setting logfile does nothing.
Status: REOPENED
Product: unbound
Classification: Unclassified
Component: server
1.8.1
x86_64 FreeBSD
: P5 major
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-19 15:01 CEST by Daniel (dmilith) Dettlaff
Modified: 2018-10-22 11:00 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel (dmilith) Dettlaff 2018-10-19 15:01:55 CEST
I basically set both:

use-syslog: yes
logfile: "/some/writable/path/service.log"

After restart it doesn't redirect anything to the log. It's throwing log into stdout/stderr.
Comment 1 Daniel (dmilith) Dettlaff 2018-10-19 15:03:09 CEST
Doh… of course It's supposed to be "use-syslog: no" there (no edit feature?)
Comment 2 Wouter Wijngaards 2018-10-19 15:15:58 CEST
Hi Daniel,

It is supposed to take the last config statement.  If fixing your config does not resolve the issue, feel free to open another one.

Best regards, Wouter
Comment 3 Daniel (dmilith) Dettlaff 2018-10-19 16:17:25 CEST
Hmm, what do you mean by last config statement? I have single one:

use-syslog: no
logfile: .../path/to/logfile.log

(was trying different order, but same result - nothing in log whatsoever)
Comment 4 Wouter Wijngaards 2018-10-19 16:22:33 CEST
Hi,

Do you start with unbound -dd (which makes it log to stderr?)

Is the file unopenable, eg. out of chroot or not accessible (wrong username, permissions, or on the directory)?  If so, that may get logged to stderr if you start with -dd.

Best regards, Wouter
Comment 5 Daniel (dmilith) Dettlaff 2018-10-19 16:50:14 CEST
No, I just start it by `unbound`. It works in background. I also have disabled chroot feature :)

kind regards
Daniel D.
Comment 6 Wouter Wijngaards 2018-10-19 16:52:40 CEST
Hi Daniel,

Are there multiple logfile statements in the config?  Perhaps print out the logfile statement with unbound-checkconf with the -o option, that also prints the final value?  Are there multiple use-syslog statements?  if so; just comment out the use-syslog statements, have none of them, only the logfile: statement that takes effect.

Best regards, Wouter
Comment 7 Daniel (dmilith) Dettlaff 2018-10-19 17:00:34 CEST
Nope. A single one. Here's my template: https://github.com/VerKnowSys/Shable/blob/master/templates/dns/unbound.conf

(in default config I have that option disabled - since logging to syslog works)
Comment 8 Daniel (dmilith) Dettlaff 2018-10-19 17:01:22 CEST
λ unbound-checkconf -o logfile
/Services/Unbound/service.log
Comment 9 Daniel (dmilith) Dettlaff 2018-10-19 17:02:30 CEST
OK, that was silly. It was created as root.. Please close the issue :)
Comment 10 Wouter Wijngaards 2018-10-19 17:04:38 CEST
Hi Daniel,

You mean the directory or file was root owned and not user unbound owned?  I guess that would do it; unbound is then supposed to log (to stderr) that it failed to open the file, though.  Thanks for the information that you fixed it!  I'll close the bug entry (You can still post comments on it, if you want, though).

Best regards, Wouter
Comment 11 Daniel (dmilith) Dettlaff 2018-10-19 17:09:03 CEST
So I did:

chmod a-w /Services/Unbound/service.log
killall unbound
unbound

nothing on STDOUT/STDERR (and nothing appended to logfile).
Comment 12 Wouter Wijngaards 2018-10-22 11:00:11 CEST
Hi,

Not sure what you are trying to do.  Unbound forks away and stderr thus disappears.  If you do not want that you need to pass commandline options, -d or -dd to also force it to log to stderr.  Or change config.

Best regards, Wouter