How pratikvmarathe/centralized-logging-api works
Project type and purpose
• This is a Java‐based reactive microservices application implementing a centralized logging system.
• Purpose: Clients generate log events periodically; a Collector service ingests and enriches them; a Server service stores them in MongoDB and exposes a query API.
File structure
• Top-level pom.xml defines four Maven modules:
• common: shared LogEntry model
• client: log‐generator microservice
• collector: TCP/UDP listener, blacklist check, forwarder
• server: Spring WebFlux API, reactive MongoDB persistence
• docker-compose.yml orchestrates MongoDB and all three services in separate Docker containers.
• server/Dockerfile and server/src/main/resources/application.yml configure containerization and service ports.
README for architectural insights
• Client services emit logs every 1–2 seconds.
• Collector listens on TCP port 9000, enriches logs, forwards to server.
• Server runs on port 8080, stores into MongoDB at mongo:27017/logdb, and provides HTTP endpoints (/ingest, /logs).
Main components
a. Log Generator Clients
• One or many instances of the client microservice (LogClient)
b. Collector Microservice
• CollectorServer: TCP/UDP listener, blacklist check, forward logic
c. Central Logging Server
• Spring WebFlux app (LogController, LogService, LogRepository)
d. Database
• MongoDB container
e. External API consumers
• curl/Postman or any HTTP client querying the /logs endpoint
Relationships and data flows
• Optional: Docker Compose orchestrates and links all containers over a common network
Architectural patterns and key technologies
• Microservices: each moduleDeploys as its own Docker container
• Reactive / Non‐blocking I/O: Spring WebFlux on server, Reactor on client/collector
• Shared domain: common.LogEntry ensures schema consistency
• Event‐driven: Collector acts as a filter/enricher between producer and consumer
• Persistence: Reactive MongoDB repository (spring-data-mongodb)
Capturing essential architectural elements
• Do not omit the common module—even if it’s not a running service, it represents the shared schema.
• Call out the reactive/nonblocking I/O pattern on the server and collector.