Skip to content

01addy/Distributed-Log-Processing-Search-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Distributed Log Processing & Search Engine

A production-grade distributed log processing and search platform built with Java, Apache Kafka, and Elasticsearch. Capable of ingesting 50,000+ log events per minute with sub-300ms search latency.

Dashboard Preview Java Spring Boot Kafka Elasticsearch React


✨ Features

  • High-throughput ingestion β€” Single and batch log ingestion via REST API, published to Kafka with 6 partitions
  • Intelligent parsing β€” Automatic detection and parsing of Logback, Log4j, JSON, and plaintext log formats
  • Real-time processing β€” Kafka consumer pipeline processes and indexes logs into Elasticsearch within seconds
  • Powerful search β€” Full-text search, filter by service/host/level/time range, trace correlation
  • Dead Letter Queue β€” Failed messages routed to log-events.DLT for reliability
  • Analytics Dashboard β€” React frontend with live charts, log level distribution, service analytics
  • Trace Timeline β€” Visualize an entire request journey across microservices by trace ID

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   React Frontend│───▢│Ingestion Service│────▢│   Apache Kafka   │───▢│Processor Serviceβ”‚
β”‚   (Port 3000)   β”‚     β”‚   (Port 8081)   β”‚     β”‚   (Port 9092)    β”‚     β”‚   (Port 8082)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                                                                          β”‚
         β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
         └────────────▢│  Search API     │◀──────────────────────────── β”‚  Elasticsearch   β”‚
                        β”‚  (Port 8083)    β”‚                              β”‚   (Port 9200)    β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Modules

Module Description
common Shared models (LogEvent, SearchRequest, SearchResponse), DTOs
ingestion REST API for receiving logs, Kafka producer, log validation
processor Kafka consumer, log parser (Logback/Log4j/JSON/Plaintext), Elasticsearch indexer
search-api Full-text search, aggregations, trace lookup, pagination
queue Kafka topic configuration, Dead Letter Queue setup

πŸš€ Quick Start

Prerequisites

  • Java 17+
  • Docker & Docker Compose
  • Node.js 18+ (for frontend)

1. Start Infrastructure

docker compose up -d zookeeper kafka elasticsearch kibana kafka-ui

Wait for all containers to be healthy (~30 seconds), then create Kafka topics:

docker exec kafka kafka-topics --bootstrap-server localhost:9092 \
  --create --if-not-exists --topic log-events --partitions 6 --replication-factor 1

docker exec kafka kafka-topics --bootstrap-server localhost:9092 \
  --create --if-not-exists --topic log-events.DLT --partitions 3 --replication-factor 1

2. Start Backend Services

Open IntelliJ IDEA and run each main class:

ingestion  β†’ IngestionServiceApplication  (port 8081)
processor  β†’ ProcessorApplication         (port 8082)
search-api β†’ SearchApiApplication         (port 8083)

3. Start Frontend

cd frontend
npm install
npm run dev

Open http://localhost:3000


πŸ“‘ API Reference

Ingestion Service (Port 8081)

Ingest Single Log

POST /api/v1/logs
Content-Type: application/json

{
  "serviceName": "payment-service",
  "host": "prod-node-01",
  "log": "2024-01-15 10:23:45.123 [main] ERROR com.example.PaymentService - Payment failed: timeout traceId=abc123"
}

Response:

{
  "status": "accepted",
  "eventId": "23847a98-6ba7-4f98-abbf-c12b260d8dca",
  "ingestedAt": "2026-02-22T13:43:35.001899Z"
}

Ingest Batch

POST /api/v1/logs/batch
Content-Type: application/json

{
  "serviceName": "auth-service",
  "host": "prod-node-02",
  "logs": [
    "INFO: User login successful userId=12345 traceId=abc123",
    "WARN: Rate limit approaching for IP 192.168.1.1",
    "ERROR: JWT token expired traceId=abc123"
  ]
}

Search API (Port 8083)

Full-Text Search

GET /api/v1/search?query=payment&serviceName=payment-service&page=0&size=20

Filter by Level

GET /api/v1/search?levels=ERROR,WARN&sortOrder=desc

Trace Lookup

GET /api/v1/search/trace/{traceId}

Get by ID

GET /api/v1/search/{id}

Search Response:

{
  "hits": [...],
  "totalHits": 42,
  "tookMs": 31,
  "page": 0,
  "size": 20,
  "totalPages": 3,
  "levelCounts": { "ERROR": 5, "WARN": 12, "INFO": 25 },
  "serviceCounts": { "payment-service": 20, "auth-service": 22 }
}

🧱 Tech Stack

Backend

Technology Version Purpose
Java 17 Core language
Spring Boot 3.3.5 Application framework
Apache Kafka 7.5.0 Message streaming
Spring Kafka 3.2.4 Kafka integration
Elasticsearch 8.11.0 Search & analytics engine
Elasticsearch Java Client 8.11.0 ES Java API
Lombok Latest Boilerplate reduction
Maven 3.x Build tool

Frontend

Technology Version Purpose
React 18 UI framework
Vite 5 Build tool & dev server
Tailwind CSS 3 Styling
Recharts 2 Charts & analytics
Axios 1.6 HTTP client
React Router 6 Client-side routing
Lucide React Latest Icons

Infrastructure

Service Port Purpose
Zookeeper 2181 Kafka coordination
Kafka 9092 Message broker
Elasticsearch 9200 Search engine
Kibana 5601 ES management UI
Kafka UI 8090 Kafka management UI

πŸ“Š Performance Targets

Metric Target Notes
Ingestion throughput 50,000+ events/min 6 Kafka partitions
Search latency < 300ms p99
Batch size Up to 1,000 logs Per request
Index refresh 5 seconds Configurable

πŸ—‚οΈ Project Structure

distributed-log-search/
β”œβ”€β”€ common/                          # Shared models and DTOs
β”‚   └── src/main/java/com/logSearch/common/
β”‚       β”œβ”€β”€ model/LogEvent.java
β”‚       └── dto/SearchRequest.java, SearchResponse.java
β”œβ”€β”€ ingestion/                       # Log ingestion service
β”‚   └── src/main/java/com/logSearch/ingestion/
β”‚       β”œβ”€β”€ controller/LogIngestionController.java
β”‚       β”œβ”€β”€ service/LogIngestionService.java
β”‚       └── config/KafkaProducerConfig.java
β”œβ”€β”€ processor/                       # Kafka consumer + ES indexer
β”‚   └── src/main/java/com/logSearch/processor/
β”‚       β”œβ”€β”€ consumer/LogEventConsumer.java
β”‚       β”œβ”€β”€ service/LogParserService.java
β”‚       └── service/ElasticsearchIndexingService.java
β”œβ”€β”€ search-api/                      # Search REST API
β”‚   └── src/main/java/com/logSearch/search/
β”‚       β”œβ”€β”€ controller/SearchController.java
β”‚       └── service/LogSearchService.java
β”œβ”€β”€ queue/                           # Kafka topic configuration
β”œβ”€β”€ docker-compose.yml
└── pom.xml

πŸ–₯️ Dashboard Screenshots

Dashboard β€” Live Analytics

Real-time log statistics, level distribution, and service breakdown charts.

Search β€” Full-Text & Filtered

Search across all logs with filters for service, level, host, and time range.

Trace Timeline

Visualize a complete request journey across microservices using trace IDs.

Ingest β€” Send Logs

Send single or batch logs directly from the UI with sample templates.


πŸ”§ Configuration

Ingestion Service (application.yml)

spring:
  kafka:
    bootstrap-servers: localhost:9092
    producer:
      batch-size: 16384
      linger-ms: 5
kafka:
  topic:
    name: log-events
    partitions: 6

Processor Service (application.yml)

spring:
  kafka:
    consumer:
      group-id: log-processor-group
      max-poll-records: 500
elasticsearch:
  index:
    prefix: applogs

Search API (application.yml)

elasticsearch:
  index:
    prefix: applogs
server:
  port: 8083

πŸ“ˆ Supported Log Formats

The processor automatically detects and parses these formats:

# Logback
2024-01-15 10:23:45.123 [main] ERROR com.example.Service - Message traceId=abc123

# Log4j
2024-01-15 10:23:45,123 ERROR [ThreadName] com.example.Service - Message

# JSON
{"level":"ERROR","message":"Something failed","timestamp":"2024-01-15T10:23:45Z","traceId":"abc123"}

# Plaintext
ERROR: Something went wrong with the payment processor

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License.


Built with β˜• Java, ⚑ Kafka, and πŸ” Elasticsearch

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors