book updates (#2345)

* edit log rotation page

* update command line options

* add github edit button
This commit is contained in:
Sacha Saint-Leger 2021-02-19 12:17:48 +01:00 committed by GitHub
parent a3a0df17f8
commit 3d25f0db01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 17 deletions

View File

@ -5,5 +5,12 @@ multilingual = false
src = "src"
title = "The Nimbus Beacon Chain Book"
[preprocessor.open-on-gh]
command = "mdbook-open-on-gh"
renderer = ["html"]
[output.html]
additional-css = ["custom.css"]
git-repository-url = "https://github.com/status-im/nimbus-eth2"
git-branch = "unstable"

View File

@ -40,3 +40,12 @@
blockquote {
padding: 10px 20px;
}
footer {
margin-top: 1rem;
margin-bottom: 1rem;
font-size: 0.8em;
text-align: center;
border-top: 1px solid black;
padding: 10px 0;
}

View File

@ -1,14 +1,14 @@
# Log rotation
Nimbus logs are written to the console, and optionally to a file. Using the log file option for a long-running process may lead to difficulties when the file grows large. This is typically solved with a log rotator that will switch which file is witten to as well as compress and remove old logs.
Nimbus logs are written to the console, and optionally to a file. Writing to a file for a long-running process may lead to difficulties when the file grows large. This is typically solved with a *log rotator*. A log rotator is responsible for switching the written to file, as well as compressing and removing old logs.
To set up file-based log rotation, an application such as [rotatelogs](https://httpd.apache.org/docs/2.4/programs/rotatelogs.html) is used - `rotatelogs` is available on most servers and can be used with `docker`, `systemd` and manual setups to write rotated logs files.
In particular, when using `systemd` and its accompanying `journald` log daemon, this setup avoids clogging the the system log and keep the Nimbus logs in a separate location.
In particular, when using `systemd` and its accompanying `journald` log daemon, this setup avoids clogging the the system log by keeping the Nimbus logs in a separate location.
## Compression
`rotatelogs` works by reading stdin and redirecting it to a file based on a name pattern. Whenever the log is about to be rotated, the application will invoke a shell script with the old and new log files. Our aim is to compress the log file to save space. [repo](https://github.com/status-im/nimbus-eth2/tree/unstable/scripts/rotatelogs-compress.sh) provides a helper script to do so:
`rotatelogs` works by reading stdin and redirecting it to a file based on a name pattern. Whenever the log is about to be rotated, the application invokes a shell script with the old and new log files. Our aim is to compress the log file to save space. [repo](https://github.com/status-im/nimbus-eth2/tree/unstable/scripts/rotatelogs-compress.sh) provides a helper script to do so:
```bash
# Create a rotation script for rotatelogs
@ -28,7 +28,7 @@ chmod +x rotatelogs-compress.sh
## Build
Logs in files generally don't benefit from colors - to avoid colors being written to the file, additional flags can be added to the Nimbus [build process](./build.md) - these flags are best saved in a build script to which one can add more options. Future versions of Nimbus will support disabling colors at runtime.
Logs in files generally don't benefit from colors. To avoid colors being written to the file, additional flags can be added to the Nimbus [build process](./build.md) -- these flags are best saved in a build script to which one can add more options. Future versions of Nimbus will support disabling colors at runtime.
```bash
@ -41,7 +41,7 @@ EOF
## Run
The final step is to redirect logs to `rotatelogs` using a pipe when starting nimbus:
The final step is to redirect logs to `rotatelogs` using a pipe when starting Nimbus:
```bash
build/nimbus_beacon_node \
@ -50,11 +50,11 @@ build/nimbus_beacon_node \
--data-dir:$DATADIR | rotatelogs -L "$DATADIR/nbc_bn.log" -p "/path/to/rotatelogs-compress.sh" -D -f -c "$DATADIR/log/nbc_bn_%Y%m%d%H%M%S.log" 3600
```
The options used in this example will:
The options used in this example do the following:
* `-L nbc_bn.log` - symlink to the latest log file, for use with `tail -F`
* `-p "/path/to/rotatelogs-compress.sh"` - script to run when rotation is about to happen
* `-D` - create the `log` directory if needed
* `-f` - open the log immediately when starting `rotatelogs`
* `-c "$DATADIR/log/nbc_bn_%Y%m%d%H%M%S.log"` - include timestamp in log filename
* `3600` - rotate logs every hour (3600 seconds)
* `-L nbc_bn.log` - symlinks to the latest log file, for use with `tail -F`
* `-p "/path/to/rotatelogs-compress.sh"` - runs `rotatelogs-compress.sh` when rotation is about to happen
* `-D` - creates the `log` directory if needed
* `-f` - opens the log immediately when starting `rotatelogs`
* `-c "$DATADIR/log/nbc_bn_%Y%m%d%H%M%S.log"` - includes timestamp in log filename
* `3600` - rotates logs every hour (3600 seconds)

View File

@ -21,7 +21,8 @@ nimbus_beacon_node [OPTIONS]... command
The following options are available:
--log-level Sets the log level.
--log-level Sets the log level for process and topics (e.g. "DEBUG;
TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none").
--log-file Specifies a path for the written Json log file.
--network The Eth2 network to join.
-d, --data-dir The directory where nimbus will store all blockchain data.
@ -29,15 +30,14 @@ The following options are available:
--secrets-dir A directory containing validator keystore passwords.
--wallets-dir A directory containing wallet files.
--web3-url URL of the Web3 server to observe Eth1.
--deposit-contract Address of the deposit contract.
--deposit-contract-block The Eth1 block number or hash where the deposit contract has
been deployed.
--non-interactive Do not display interative prompts. Quit on missing
configuration.
--netkey-file Source of network (secp256k1) private key file
(random|<path>) (default: random).
--insecure-netkey-password Use pre-generated INSECURE password for network private key
file (default: false).
--agent-string Node agent string which is used as identifier in network.
--subscribe-all-subnets Subscribe to all attestation subnet topics when gossiping.
-b, --bootstrap-node Specifies one or more bootstrap nodes to use when connecting
to the network.
--bootstrap-file Specifies a line-delimited file of bootstrap Ethereum network
@ -49,6 +49,10 @@ The following options are available:
--max-peers The maximum number of peers to connect to.
--nat Specify method to use for determining public address. Must be
one of: any, none, upnp, pmp, extip:<IP>.
--enr-auto-update Discovery can automatically update its ENR with the IP
address and UDP port as seen by other nodes it communicates
with. This option allows to enable/disable this
functionality.
--weak-subjectivity-checkpoint Weak subjectivity checkpoint in the format
block_root:epoch_number.
--finalized-checkpoint-state SSZ file specifying a recent finalized state.
@ -76,5 +80,11 @@ The following options are available:
--discv5 Enable Discovery v5.
--dump Write SSZ dumps of blocks, attestations and states to data
dir.
```
--doppelganger-detection Whether to detect whether another validator is be running the
same validator keys (default true).
Available sub-commands:
...
```