## Login Logs ETL & Analysis Project
This project collects, cleans, and analyzes user login logs. It helps identify user activity, successful and failed login attempts, and suspicious behavior by IP and time patterns.

## Features
    Loads login logs from PostgreSQL
    Cleans data:
        Removes empty and duplicate records
        Adds derived columns: date, hour, is_success
    Saves cleaned data into a new table login_logs_clean
    Performs analytics queries:
        General metrics: total rows, date range
        Successful vs. failed login attempts
        Unique users and IP counts
        Users/IPs with high activity
        Metrics by weekday, hour, and night time
        IPs with high failure rates

## Data Structure
    Raw Logs (login_logs)
    Column	Description
    log_date	Date and time of the event
    user_id	User identifier
    user_ip	IP address
    device_info	Device information
    login_status	Login status (1 = success, 0/other = failed)

## Cleaned Logs (login_logs_clean)
    Column	Description
    All raw columns	Preserved from original logs
    date	Date of the event (without time)
    hour	Hour of the event
    is_success	True/False for successful login

## Requirements
    Python 3.9+
    pandas
    numpy
    matplotlib
    seaborn
    SQLAlchemy
    psycopg2-binary
    PostgreSQL with access to the sdu_logs database

## Example Queries
    Total rows and date range
    Number of unique users and IPs
    Top IPs by login attempts
    Top users logging in from multiple IPs
    Login attempts by hour and weekday
    Share of night-time login attempts
    IPs with the highest failed login rate