The Logger is a simple HTTP server that accepts log entries and stores them in a MongoDB database.
- Accepts log entries via HTTP POST requests.
- Stores log entries in a MongoDB database.
- Minimal setup and easy to use.
Before running the Logger, ensure you have the following installed:
- Rust programming language and Cargo package manager
- MongoDB server
-
Clone the repository:
git clone https://github.com/HeliosShieldProject/logger-rust.git
-
Navigate to the project directory:
cd logger-rust
-
Install dependencies:
cargo build --release
-
Configure the environment variables in the
.env
file:MONGO_URL=<MongoDB connection URL> LOGGER_PORT=<Port number for the logger service>
-
Run the Logger Service:
cargo run
-
Once the service is running, it will listen for HTTP POST requests at
http://localhost:<LOGGER_PORT>/log
. -
Send log entries to the service using HTTP POST requests with JSON payloads containing the log data.
To send a log entry to the service, you can use tools like cURL or Postman. Here's an example using cURL:
curl -X POST -H "Content-Type: application/json" -d '{"message": "This is a log message"}' http://localhost:<LOGGER_PORT>/log