syslog and journald cases splitted
This commit is contained in:
parent
36b2ed172c
commit
b040cbffdd
@ -35,15 +35,17 @@ as the watchdog.
|
|||||||
!!! Note
|
!!! Note
|
||||||
The sd_notify communication between the bot and the systemd service manager will not work if the bot runs in a Docker container.
|
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
|
## Advanced Logging
|
||||||
|
|
||||||
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:
|
On many Linux systems the bot can be configured to send its log messages to `syslog` or `journald` system services. Logging to a remote `syslog` server is also available on Windows. The special values for the `--logfilename` command line 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.
|
### Logging to syslog
|
||||||
|
|
||||||
* `--logfilename syslog:<syslog_address>` -- send log messages to `syslog` server using the `<syslog_address>` as syslog address.
|
To send Freqtrade log messages to a local or remote `syslog` service use the `--logfilename` command line option with the value in the following format:
|
||||||
|
|
||||||
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.
|
* `--logfilename syslog:<syslog_address>` -- send log messages to `syslog` service using the `<syslog_address>` as the 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:
|
So, the following are the examples of possible usages:
|
||||||
|
|
||||||
@ -51,23 +53,37 @@ So, the following are the examples of possible usages:
|
|||||||
* `--logfilename syslog` -- same as above, the shortcut for `/dev/log`.
|
* `--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:/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:localhost:514` -- log to local syslog using UDP socket, if it listens on port 514.
|
||||||
* `--logfilename syslog:<ip>:514` -- log to remote syslog at IP address and port 514. This may be used on Windows for remote logging to external syslog server.
|
* `--logfilename syslog:<ip>:514` -- log to remote syslog at IP address and port 514. This may be used on Windows for remote logging to an external syslog server.
|
||||||
|
|
||||||
Log messages are send to `journald` and `syslog` with the `user` facility. So you can see them with the following commands:
|
Log messages are send to `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;
|
* `tail -f /var/log/user`, or
|
||||||
* `journalctl -f` when logging to `journald`.
|
* install a comprehensive graphical viewer (for instance, 'Log File Viewer' for Ubuntu).
|
||||||
|
|
||||||
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.
|
On many systems `syslog` (`rsyslog`) fetches data from `journald` (and vice versa), so both `--logfilename syslog` or `--logfilename journald` can be used and the messages be viewed with both `journalctl` and a syslog viewer utility. You can combine this in any way which suites you better.
|
||||||
|
|
||||||
For rsyslog the messages from the bot can be redirected into a separate dedicated log file. To achieve this, add
|
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
|
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`.
|
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`:
|
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 a single message when nothing else happens with the bot. To achieve this, set in `/etc/rsyslog.conf`:
|
||||||
```
|
```
|
||||||
# Filter duplicated messages
|
# Filter duplicated messages
|
||||||
$RepeatedMsgReduction on
|
$RepeatedMsgReduction on
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Logging to journald
|
||||||
|
|
||||||
|
This needs the `systemd` python package installed as the dependency, which is not available on Windows. Hence, the whole journald logging functionality is not available for a bot running on Windows.
|
||||||
|
|
||||||
|
To send Freqtrade log messages to `journald` system service use the `--logfilename` command line option with the value in the following format:
|
||||||
|
|
||||||
|
* `--logfilename journald` -- send log messages to `journald`.
|
||||||
|
|
||||||
|
Log messages are send to `journald` with the `user` facility. So you can see them with the following commands:
|
||||||
|
|
||||||
|
* `journalctl -f` -- shows Freqtrade log messages sent to `journald` along with other log messages fetched by `journald`. There are many options to filter the messages, see manual pages for the `journalctl` utility.
|
||||||
|
|
||||||
|
On many systems `syslog` (`rsyslog`) fetches data from `journald` (and vice versa), so both `--logfilename syslog` or `--logfilename journald` can be used and the messages be viewed with both `journalctl` and a syslog viewer utility. You can combine this in any way which suites you better.
|
||||||
|
Loading…
Reference in New Issue
Block a user