minibolt-guide / minibolt

A step-by-step guide to building a Bitcoin & Lightning node, and other stuff on a personal computer
https://minibolt.info
MIT License
74 stars 37 forks source link

[UPDATE MAIN GUIDE] send bitcoind logs to stdout and let systemd pick them up #23

Closed 1ma closed 1 year ago

1ma commented 1 year ago

What

This PR proposes that bitcoind send its logs to standard output instead of the debug.log file. With this change journald reads and process the logs like those of any other system service.

Why

This change has, in my opinion, a couple benefits:

  1. bitcoind logs are queried with journalctl like any other system service, allowing more nuanced queries. For instance:

    $ journalctl --since "yesterday" --until "-3 hour" -u bitcoind.service
  2. As part of its duties systemd-journald takes care of prunning old logs. With debug.log we have an unmanaged file that always grows and has to be pruned manually from time to time by the node operator.

How

nodebuglogfile=1 turns off file logging and turns on STDOUT output. A change in the type of systemd service is also needed for journald to be able to read the logs: https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=

Scope

twofaktor commented 1 year ago

Let's go to the main!! :rocket: Thanks!! @1ma