From a183162d8b7248fde6b8dd91e4c652dd224b8916 Mon Sep 17 00:00:00 2001 From: hroff-1902 <47309513+hroff-1902@users.noreply.github.com> Date: Sat, 23 Nov 2019 03:37:29 +0300 Subject: [PATCH] Add description into Advanced Setup section --- docs/advanced-setup.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/docs/advanced-setup.md b/docs/advanced-setup.md index e6334d2c1..c50527c8b 100644 --- a/docs/advanced-setup.md +++ b/docs/advanced-setup.md @@ -31,3 +31,40 @@ as the watchdog. !!! Note The sd_notify communication between the bot and the systemd service manager will not work if the bot runs in a Docker container. + +## Logging to syslog or journald + +On many systems the bot can be configured to send its log messages to `syslog` or `journald`. The special values for the `--logfilename` option can be used for this: + +* `--logfilename journald` -- send log messages to `journald`. This needs the `systemd` python package installed as the dependency. Not available on Windows. + +* `--logfilename syslog:` -- send log messages to `syslog` server using the `` as syslog address. + +The syslog address can be either a Unix domain socket (socket filename) or a UDP socket specification, consisting of IP address and UDP port, separated by the ':' character. + +So, the following are the examples of possible usages: + +* `--logfilename syslog:/dev/log` -- log to syslog (rsyslog) using the `/dev/log` socket, suitable for most systems. +* `--logfilename syslog` -- same as above, the shortcut for `/dev/log`. +* `--logfilename syslog:/var/run/syslog` -- log to syslog (rsyslog) using the `/var/run/syslog` socket. Use this on MacOS. +* `--logfilename syslog:localhost:514` -- log to local syslog using UDP socket, if it listens on port 514. +* `--logfilename syslog::514` -- log to remote syslog at IP address and port 514. This may be used on Windows for remote logging to external syslog server. + +Log messages are send to `journald` and `syslog` with the `user` facility. So you can see them with the following commands: + +* `tail -f /var/log/user`, or install a comprehansive graphical viewer (for instance, 'Log File Viewer' for Ubuntu) for the `syslog` case; +* `journalctl -f` when logging to `journald`. + +On many systems rsyslog (syslog) fetches data from journald, so both `--logfilename syslog` or `--logfilename journald` can be used and the messages be viewed with both journalctl and the syslog viewer utility. + +For rsyslog the messages from the bot can be redirected into a separate dedicated log file. To achieve this, add +``` +if $programname startswith "freqtrade" then -/var/log/freqtrade.log +``` +to one of the rsyslog configuration files, for example at the end of the `/etc/rsyslog.d/50-default.conf`. + +For syslog (rsyslog), the reduction mode can be switched on. This will reduce the number of repeating messages. For instance, multiple bot Heartbeat messages will be reduced to the single message when nothing else happens with the bot. To achieve this, set in `/etc/rsyslog.conf`: +``` +# Filter duplicated messages +$RepeatedMsgReduction on +```