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.
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.logFeatures:
- β Stdin/file input
- β Colorful ANSI output
- β JSON export
- β Custom variable definitions
- β Flexible clustering options
# Build
./gradlew :logmine-cli:installDist
# Run
cat /var/log/application.log | ./logmine-cli/build/install/logmine-cli/bin/logmine-cliNote: Not yet published to Maven Central. For now, build from source and use
publishToMavenLocal.
Build and Install Locally:
./gradlew :logmine-core:publishToMavenLocalThen 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 * *git clone https://github.com/swcraftsmen/logmine
cd logmine
./gradlew build# Core library
./gradlew :logmine-core:build
# CLI tool
./gradlew :logmine-cli:build
# Benchmarks
./gradlew :logmine-benchmarks:jmhJar# All tests
./gradlew test
# Specific module
./gradlew :logmine-core:testlogmine-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
- β 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
- β 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
- Core Library README - Full library documentation
- Understanding the Algorithm - How LogMine works
- Configuration Guide - Configuration options
- Multi-Format Support - Handling different log formats
- Hierarchical Patterns - Multi-level pattern extraction
- CLI Documentation - Command-line tool guide
- Benchmark Guide - Performance benchmarks
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
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
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.
- GitHub: https://github.com/swcraftsmen/logmine
- Website: https://swengdev.org
- Issues: https://github.com/swcraftsmen/logmine/issues
- Discussions: https://github.com/swcraftsmen/logmine/discussions
- Author: Zachary Huang
- GitHub: @swcraftsmen
Happy Log Mining! πͺ΅βοΈ