Server log management is a critical task for organizations relying on web services, but it often presents challenges such as processing large volumes of data, identifying performance bottlenecks, and detecting security threats. Traditional approaches may be inefficient, lacking real-time updates or actionable insights. The proposed system addresses these issues by providing a real-time, web based solution for analyzing and visualizing server log data. Built using Flask, SQLAlchemy, Pandas, and Plotly, the system streamlines log analysis through intuitive dashboards and advanced visualizations. It identifies key metrics such as frequent IPs, request patterns, status code distributions, and device, allowing administrators to monitor server activity effectively. This system empowers users to quickly detect anomalies, optimize server performance, and enhance security by uncovering patterns and irregularities in the data. With user-friendly interfaces, it ensures that administrators have immediate access to critical insights, facilitating prompt and informed decision-making. By resolving the inefficiencies of traditional log management, the system is an essential tool for improving server reliability and operational efficiency. The system employs quantitative methodologies to derive insights from numeric and structured log data, presenting the results through intuitive visualizations and summary metrics. By combining robust data processing capabilities with interactive dashboards, this system is a comprehensive tool for server management and performance analysis, streamlining troubleshooting and decision-making processes.
Make sure to create the .env file and give a value to the SECRET_KEY in it. Then run the main.py and go to website link, now you have the system running.
A comprehensive real-time web application for analyzing and visualizing server log data. This system provides administrators with powerful tools to monitor server performance, detect anomalies, and gain insights into user behavior patterns.
- Live Data Extraction: Automatically processes new log entries from raw log files
- Real-time Updates: WebSocket-based live updates to dashboards
- File Monitoring: Watches log files for changes and processes them automatically
- Overview Dashboard: Comprehensive metrics and visualizations
- IP Tracking: Detailed analysis of specific IP addresses
- URL Tracking: Analysis of specific request paths and endpoints
- User Management: Admin interface for user account management
- Traffic Analysis: Request patterns over time, peak usage periods
- Status Code Distribution: HTTP response code analysis with pie charts
- Device Analysis: User agent parsing and device type distribution
- Geographic Analysis: IP geolocation mapping (optional)
- Performance Monitoring: Response time tracking and bottleneck identification
- User Authentication: Secure login system with password hashing
- Session Management: Flask-Login integration for secure sessions
- Admin Controls: User creation, deletion, and password management
- Backend: Flask (Python web framework)
- Database: SQLite with SQLAlchemy ORM
- Data Processing: Pandas for data manipulation and analysis
- Visualization: Plotly for interactive charts and graphs
- Real-time: Flask-SocketIO for live updates
- Authentication: Flask-Login for user management
- File Monitoring: Watchdog for log file changes
server-log-analysis-main/
βββ ServerLogAnalysis/
β βββ app.py # Main Flask application
β βββ main.py # Application entry point
β βββ config.py # Configuration settings
β βββ data_queries.py # Database query functions
β βββ Geolocation_Analysis.py # IP geolocation features
β βββ data/
β β βββ raw/ # Raw log files
β β βββ csv/ # Processed CSV data
β β βββ processed/ # Analysis output files
β βββ templates/ # HTML templates
β β βββ index.html # Main dashboard
β β βββ login.html # Login page
β β βββ track_ip.html # IP tracking page
β β βββ track_url.html # URL tracking page
β βββ utils/
β βββ data_extractor.py # Log parsing and CSV conversion
β βββ SummaryAnalysis.py # Statistical analysis
β βββ SetEnv.py # Environment configuration
βββ requirements.txt # Python dependencies
βββ README.md
- Python 3.7 or higher
- pip (Python package installer)
-
Clone the repository
git clone <repository-url> cd server-log-analysis-main
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables Create a
.env
file in the project root:SECRET_KEY=your-secret-key-here
-
Prepare log data
- Place your server log files in
ServerLogAnalysis/data/raw/
- The system expects Apache/Nginx style log format
- Place your server log files in
-
Run the application
cd ServerLogAnalysis python main.py
-
Access the dashboard
- Open your browser and go to
http://localhost:5000
- Default admin credentials: username:
ak
, password:ak249
- Open your browser and go to
- View real-time server metrics and visualizations
- Monitor request patterns, status codes, and device distributions
- Access summary statistics and performance indicators
- Select specific IP addresses from the dropdown
- Analyze request patterns, status codes, and device types for that IP
- View time-series data for suspicious or high-activity IPs
- Track specific request paths and endpoints
- Analyze which IPs are accessing particular resources
- Monitor performance and error rates for specific URLs
- Create new user accounts
- Manage existing users
- Change passwords securely
The system uses SQLite by default. To use PostgreSQL:
- Update
config.py
with your database URI - Install
psycopg2
for PostgreSQL support
The system expects logs in Apache/Nginx format:
IP - - [timestamp] "method path protocol" status size "user-agent" "referrer"
- Modify
data_extractor.py
to support different log formats - Update visualization parameters in
app.py
- Customize HTML templates in the
templates/
directory
- Total requests and unique IP addresses
- Status code distribution and most common responses
- Average response times and performance metrics
- Hourly and daily request patterns
- Peak usage identification
- Geographic distribution (with geolocation enabled)
- Suspicious IP detection
- Error rate monitoring
- User agent analysis for bot detection
- Password hashing with Werkzeug
- Session-based authentication
- CSRF protection
- Input validation and sanitization
GET /
- Main dashboardGET /login
- Login pagePOST /login
- AuthenticationGET /track_ip
- IP tracking interfacePOST /track_ip
- IP analysis dataGET /track_url
- URL tracking interfacePOST /track_url
- URL analysis dataGET /manage_users
- User managementPOST /signup
- User registrationPOST /change_password
- Password change
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Check the project documentation
- Review existing issues
- Create a new issue with detailed description
The system automatically:
- Monitors log files for new entries
- Updates the database with new data
- Refreshes visualizations in real-time
- Maintains data integrity and consistency