Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Log Analyzer

A Java command-line tool that analyzes log files and exports structured JSON summaries.

Features

  • Smart Log Parsing - Automatically detects ERROR, WARNING, and INFO levels
  • Frequency Analysis - Tracks most common errors
  • JSON Export - Structured output for integration with monitoring tools
  • JUnit Tests - 12 unit tests validating core functionality

Quick Start

Prerequisites

  • Java 11+
  • Maven 3.6+

Run

mvn clean package
java -jar target/log-analyzer-1.0-SNAPSHOT.jar

Example

Input: application.log

2025-01-18 ERROR Database connection failed
2025-01-18 INFO Application started
2025-01-18 WARNING Low memory detected
2025-01-18 ERROR Database connection failed

Output: log-summary_2025-01-18_10-30-00.json

{
  "timestamp": "2025-01-18",
  "fileAnalyzed": "application.log",
  "totalErrors": 2,
  "totalWarnings": 1,
  "totalInfo": 1,
  "mostFrequentErrors": [
    {
      "message": "ERROR Database connection failed",
      "count": 2
    }
  ]
}

Technologies

  • Java 14
  • Maven
  • Jackson (JSON processing)
  • JUnit 4

Project Structure

src/
├── main/java/loganalyzer/
│   ├── LogAnalyzer.java      # Core analysis logic
│   ├── JsonExporter.java     # JSON export
│   └── ProgramRunner.java    # Main application
└── test/java/loganalyzer/
    └── *Test.java             # Unit tests

Use Cases

  • Automated error monitoring
  • Integration with dashboards (Grafana, ELK)
  • Historical error tracking

About

A Java command-line tool that analyzes log files and exports structured JSON summaries.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages