Skip to content

swcraftsmen/logmine-java

Repository files navigation

LogMine - Fast Pattern Recognition for Log Analytics

Java License Build

Unsupervised log pattern extraction library and tools for real-time log analytics.

LogMine automatically discovers patterns in log data without predefined templates, making it perfect for monitoring unknown or changing log formats.


Project Modules

This is a multi-module project with the following components:

πŸ”§ logmine-core - Core Library

The main LogMine library for pattern extraction and log analysis.

Features:

  • βœ… Unsupervised pattern extraction
  • βœ… Real-time streaming mode
  • βœ… Zero external dependencies
  • βœ… Thread-safe processing
  • βœ… STREAMING: 8K logs/s; BATCH: 158K logs/s collection

β†’ View Core Library Documentation


logmine-cli - Command-Line Tool

A powerful CLI for analyzing log files from the terminal.

# Analyze logs
cat application.log | logmine-cli
logmine-cli -m 0.4 application.log

# With custom variables
logmine-cli \
  -v '<time>:/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/' \
  -v '<ip>:/\d+\.\d+\.\d+\.\d+/' \
  application.log

Features:

  • βœ… Stdin/file input
  • βœ… Colorful ANSI output
  • βœ… JSON export
  • βœ… Custom variable definitions
  • βœ… Flexible clustering options

β†’ View CLI Documentation


πŸš€ Quick Start

Option 1: Use the CLI Tool (Easiest)

# Build
./gradlew :logmine-cli:installDist

# Run
cat /var/log/application.log | ./logmine-cli/build/install/logmine-cli/bin/logmine-cli

Option 2: Use as Library

Note: Not yet published to Maven Central. For now, build from source and use publishToMavenLocal.

Build and Install Locally:

./gradlew :logmine-core:publishToMavenLocal

Then add to your project:

Gradle:

repositories {
    mavenLocal()
}

dependencies {
    implementation("org.swengdev.logmine:logmine-core:unspecified")
}

Maven:

<dependency>
    <groupId>org.swengdev.logmine</groupId>
    <artifactId>logmine-core</artifactId>
    <version>unspecified</version>
</dependency>

Code:

import org.swengdev.logmine.*;

// Create and use
LogMine logMine = new LogMine();
logMine.addLog("GET /api/users/123 HTTP/1.1 200 45ms");
logMine.addLog("GET /api/users/456 HTTP/1.1 200 67ms");

List<LogPattern> patterns = logMine.getCurrentPatterns();
// Pattern: GET * HTTP/1.1 * *

Building from Source

Build All Modules

git clone https://github.com/swcraftsmen/logmine
cd logmine
./gradlew build

Build Individual Modules

# Core library
./gradlew :logmine-core:build

# CLI tool
./gradlew :logmine-cli:build

# Benchmarks
./gradlew :logmine-benchmarks:jmhJar

Run Tests

# All tests
./gradlew test

# Specific module
./gradlew :logmine-core:test

Project Structure

logmine-project/
β”œβ”€β”€ logmine-core/        # Core library
β”‚   β”œβ”€β”€ src/             # Source code
β”‚   β”œβ”€β”€ docs/            # Core documentation
β”‚   β”œβ”€β”€ README.md        # Library documentation
β”‚   └── build.gradle.kts
β”‚
β”œβ”€β”€ logmine-cli/         # Command-line tool
β”‚   β”œβ”€β”€ src/             # CLI source code
β”‚   β”œβ”€β”€ README.md        # CLI documentation
β”‚   └── build.gradle.kts
β”‚
β”œβ”€β”€ logmine-benchmarks/  # JMH performance benchmarks
β”‚   β”œβ”€β”€ src/jmh/         # Benchmark code
β”‚   β”œβ”€β”€ README.md        # Benchmark documentation
β”‚   └── build.gradle.kts
β”‚
β”œβ”€β”€ build.gradle.kts     # Root build file
β”œβ”€β”€ settings.gradle.kts  # Multi-module configuration
β”œβ”€β”€ VERSIONING.md        # Versioning guide
β”œβ”€β”€ LICENSE              # Apache License 2.0
└── CITATION.cff         # Citation information

🎯 Key Features

Core Library

  • βœ… Unsupervised Learning - No templates needed
  • βœ… Real-Time Processing - Streaming mode for unlimited logs
  • βœ… Zero Dependencies - No external libraries required
  • βœ… Thread-Safe - Concurrent processing support
  • βœ… Stable Pattern IDs - Content-based hashing for storage/correlation
  • βœ… Performance - STREAMING: 8K logs/s; BATCH: 158K logs/s collection

CLI Tool

  • βœ… Easy to Use - Simple command-line interface
  • βœ… Colorful Output - ANSI colored terminal display
  • βœ… Flexible Input - Stdin pipes or file arguments
  • βœ… JSON Export - Machine-readable output
  • βœ… Customizable - Variables, thresholds, placeholders

πŸ“š Documentation

Core Documentation

Tools & Benchmarks

Project Information


Research Paper

LogMine is based on the research paper:

Hamooni, H., Debnath, B., Xu, J., Zhang, H., Jiang, G., & Mueen, A. (2016).
LogMine: Fast Pattern Recognition for Log Analytics.
In Proceedings of the 25th ACM International Conference on Information and Knowledge Management (CIKM '16).
DOI: 10.1145/2983323.2983358

Paper: PDF


🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  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

Copyright 2024 Zachary Huang

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

See the LICENSE file for full details.


πŸ”— Links


Contact


Happy Log Mining! πŸͺ΅β›οΈ

About

Unsupervised log pattern extraction for Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors