Skip to content

Pumpkin-cod/logging_with_python

Repository files navigation

NodeJsApp Log Analysis

Description

This project provides a set of Python scripts to analyze the NodeJsApp.log file. The scripts extract and summarize various statistics from the log, including unique IP addresses, request counts per IP, endpoint access counts, User-Agent request counts, and request frequency within a 10-second window.

Scripts and Their Functionality

  • App.py
    Extracts unique IPv4 addresses from the log file and prints the unique IPs along with their count.

  • counter.py
    Counts the number of requests per IP address (supports IPv4 and IPv6-mapped IPv4) and prints the counts, total unique IPs, and total requests.

  • endpoint_was_accessed.py
    Counts how many times each endpoint (URL path) was accessed and prints the counts, total unique endpoints, and total requests.

  • user_agent_requests.py
    Counts the number of requests per User-Agent string and prints the counts, total unique user agents, and total requests.

  • 10_seconds_window.py
    Analyzes requests per IP address within a 10-second window from the first request timestamp and prints the count of requests made by each IP within that window.

Requirements

  • Python 3.x (no external dependencies; uses only Python standard library)

Usage

Run each script individually using Python from the command line:

python3 App.py
python3 counter.py
python3 endpoint_was_accessed.py
python3 user_agent_requests.py
python3 10_seconds_window.py

Ensure the NodeJsApp.log file is present in the same directory as the scripts.

Output

Each script prints its respective analysis results to the console, including counts and summaries as described above.


This project is useful for basic log analysis and monitoring of application request logs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages