How anshikagarg2005/java-log-analyzer works
Project type and purpose
• This is a Java-based command-line tool (“Suspicious Activity Detection CLI Tool”) for parsing server logs, detecting suspicious IP addresses (3+ failed logins within 60 seconds), enriching them with geolocation via an external API, and presenting/exporting results.
• It is neither a web app nor a microservices system, but a standalone, pipeline-style CLI utility.
File structure
• Top-level directories:
• lib/ → external JARs (JSON parsing library)
• logs/ → sample input log files
• src/ → Java source code files
• out/ → compiled .class files
• test/ → unit tests
• Key source files (in src/):
• main.java → CLI entrypoint, argument parsing, menu
• LogParser.java → reads/parses Apache-style log lines into LogEntry objects
• GeoIPService.java → calls external HTTP API, parses JSON, returns country info
• SuspiciousIPDetector.java → core detection logic, scanning sequences of failures
• CSVExporter.java → writes results to CSV
• Utils.java → shared helpers (e.g., date parsing)
• There’s one external dependency (org.json) loaded from lib/json-…jar, invoked by GeoIPService.
README for additional insights
• Confirms pipeline: read → detect → enrich → display/export.
• Mentions interactive menu, CLI flags (--file, --export).
Elements
• Clear labels for each component/module
• Rectangles for internal modules (parsing, detection, exporting)