Simple and multithreading TCP/UDP logger. It writes data to a plain text file and it also provides additional functionalities such as log file rotation, control the number of rotated files, etc.
Written in Rust language.
Jon Postel in 1994, with map of Internet top-level domains.
- Rust stable:
rustup install stable
rustup default stable
Execute from the terminal:
RUST_LOG=info cargo run
The config is written in TOML.
Default config is set in ./config/default.toml.
Optionally you can add a config file by environment setting RUN_MODE={development|production|anything}
in your environment and providing the appropriate file: ./config/{development|production|anything}.toml
You can provide environment variable to define log level and override configuration:
- Log level:
RUST_LOG={debug|info|warn|error}
. Also it's possible to define the level for a specific module:RUST_LOG=writer=debug
turns on debug logging forwriter
module. - Override config: define variable with a prefix of APP. Eg:
APP_filewriter_rotation_policy=ByDay
would set:
[filewriter.rotation]
policy = "ByDay"
Running with inline environment variable from the terminal:
RUST_LOG=info APP_filewriter_rotation_policy=ByDuration cargo run
Execute from the terminal:
cargo test
Having a log server listening at 0.0.0.0:8080
via UDP. To send it log for 10 seconds, just execute from the terminal:
RUST_LOG=info cargo run --example logging_client -- --address '127.0.0.1:8080' --duration 10
If the server is listening via TCP:
RUST_LOG=info cargo run --example logging_client -- --address '127.0.0.1:8080' --duration 10 --tcp
Apache-2.0