https://github.com/kartikmehta8/udp-logger
This project implements a lightweight, UDP-based distributed logging system in Node.js.
https://github.com/kartikmehta8/udp-logger
node udp udp-server
Last synced: about 2 months ago
JSON representation
This project implements a lightweight, UDP-based distributed logging system in Node.js.
- Host: GitHub
- URL: https://github.com/kartikmehta8/udp-logger
- Owner: kartikmehta8
- Created: 2024-11-14T16:03:31.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-11-14T16:03:53.000Z (6 months ago)
- Last Synced: 2025-03-28T03:58:43.421Z (about 2 months ago)
- Topics: node, udp, udp-server
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Distributed Logger System with UDP
This project implements a lightweight, UDP-based distributed logging system in Node.js.
The logging server aggregates log messages from multiple distributed clients, using UDP to receive logs quickly without HTTP overhead.
This project demonstrates SOLID principles and design patterns, with a central logging server that can log to console, files, and future extendable storage options.## Project Structure
```
distributed-logger
├── server
│ ├── config
│ │ └── index.js # Configuration file for server settings
│ ├── logger
│ │ ├── Logger.js # Logger class implementing the Facade Pattern
│ │ ├── handlers
│ │ │ ├── ConsoleHandler.js # Handler for console output
│ │ │ ├── FileHandler.js # Handler for saving logs to files
│ │ └── parsers
│ │ └── LogParser.js # Parses incoming log messages
│ ├── udpServer.js # UDP server to receive log messages
│ └── index.js # Main entry point
├── client
│ ├── loggerClient.js # Client script for sending logs via UDP
├── logs # Directory for storing log files
└── package.json # Node.js dependencies and scripts
```## Features
- **UDP-Based Logging**: Each client application sends logs to a central server via UDP for minimal latency.
- **SOLID Design**: Handlers for logging (console, file) follow the Single Responsibility Principle.
- **Extensible Logging Handlers**: Easily add new handlers (e.g., database, cloud storage).## Installation
1. Clone the repository:
```bash
git clone
cd distributed-logger
```2. Install dependencies:
```bash
npm install
```## Usage
### 1. Start the Logging Server
To start the logging server, run:
```bash
node server/index.js
```The server listens for UDP messages on the configured port (default: `41234`), as specified in `config/index.js`. It will display received logs in the console and store them in the `logs` directory.
### 2. Run the Client Logger
Open a new terminal window, then run the client script to send sample log messages:
```bash
node client/loggerClient.js
```The client will send various logs (INFO, ERROR, DEBUG) to the server. The server console should display incoming logs and append them to `logs/app.log`.