Skip to content

cspinetta/jon-listen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jon Listen

Build Status

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.

alt text

Jon Postel in 1994, with map of Internet top-level domains.

Dependencies

  • Rust stable:
rustup install stable
rustup default stable

Start server

Execute from the terminal:

RUST_LOG=info cargo run

Config file

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

Config from the environment

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 for writer 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

Run tests

Execute from the terminal:

cargo test

Testing through logging_client

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

License

Apache-2.0

About

Simple and multithreading TCP/UDP Logging Server

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published