Skip to content

cspinetta/jon-listen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 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.

Requirements

  • Rust stable (Edition 2021)
rustup install stable
rustup default stable

Start server

Run from the terminal:

RUST_LOG=info cargo run
  • Press Ctrl+C to gracefully stop the server.

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}. You can set per-module levels: RUST_LOG=writer=debug enables debug for the writer module.
  • Override config: define variables 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

Examples

Simple UDP sender (sends N messages):

cargo run --example send_via_udp -- 127.0.0.1:8080 1000

Minimal logging client (UDP or TCP) for a duration:

cargo run --example logging_client -- --address 127.0.0.1:8080 --duration 10
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

Contributors 2

  •  
  •