8000 GitHub - kaelthasmanu/SquidStats: SquidStats
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

kaelthasmanu/SquidStats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SQUIDSTAT logo
The definitive analysis for your proxy

GitHub repo size GitHub License GitHub stars GitHub forks GitHub top language GitHub contributors Watchers

โญ Give me one star โ€” it will motivate me to keep improving it!!

Table of contents
  1. About the Project
  2. Getting Started
  3. To do
  4. Contributing
  5. License
  6. Contact
  7. Technologies Used
  8. Special thanks

About the Project

A modern tool for parsing and analyzing Squid logs, providing a sleek and user-friendly dashboard to visualize real-time connection data. This project helps network administrators monitor and manage Squid proxy connections effectively.

You can view the example here.

fig1
fig2
fig3

Goals of this project :

  • Real-time Log Parsing: Parses active Squid connections and displays detailed information.
  • User Monitoring: Identifies connections by username, URI, and log type.
  • Metrics Overview:
    • Total read and written data for each connection.
    • Number of requests per connection.
    • Delay pool usage.
  • Interactive Dashboard: Clean interface for easy data interpretation.
  • Squid Cache Statistics:
    • Stored entries.
    • Used and free capacity
    • Maximum and current cache size
    • Disk space and inode usage
    • Age of cached objects
  • Logs Users:
    • User activity monitoring ๐Ÿ‘ฅ
    • Beautiful visualizations ๐Ÿ“Š
    • Advanced filtering & search ๐Ÿ”
    • Paginated results ๐Ÿ“„
  • Top Graphs:
    • Top 20 Users Activity
    • Top 20 Users Data Usage
    • Total Users
    • Total Transmitted Data
    • Total Request
    • And More...
  • And More

Getting Started

SquidStat

The entire installation process in more detail can be found here.

Prerequisites

  • Python 3.10+
  • Squid proxy server
  • squidclient installed on the server
apt install git python3 python3-pip python3-venv python3-pymysql libmariadb-dev curl
  • โš ๏ธ !!Important โš ๏ธ For compatibility with user logs, use this format in /etc/squid/squid.conf:
  logformat detailed \
  "%ts.%03tu %>a %ui %un [%tl] \"%rm %ru HTTP/%rv\" %>Hs %<st %rm %ru %>a %mt %<a %<rm %Ss/%Sh %<st

  access_log /var/log/squid/access.log detailed

Installation Script

  1. Get Script With curl o wget:
 wget https://github.com/kaelthasmanu/SquidStats/releases/download/0.2/install.sh
  1. Add permission execution:
 sudo chmod +x install.sh
  1. Execute the script:
 sudo ./install.sh

Installation Options

The installer now supports multiple modes:

# Full installation (interactive)
sudo ./install.sh

# Update existing installation
sudo ./install.sh --update

# Configure blacklist only
sudo ./install.sh --configure-blacklist

# Show help
./install.sh --help

๐Ÿ›ก๏ธ Blacklist Configuration

During installation, you can configure which domains notify like block:

  • Option 1: Use default blacklist (facebook.com, twitter.com, instagram.com, etc.)
  • Option 2: Configure custom domains
  • Option 3: Skip blacklist configuration

Example custom configuration:

# When prompted, enter domains separated by commas:
facebook.com,twitter.com,youtube.com,netflix.com,tiktok.com

Installation Manual

  1. Clone the repository:
    mkdir -p /opt/squidstats
    git clone https://github.com/kaelthasmanu/SquidStats.git /opt/squidstats
  2. Creating a virtual environment (venv):
 cd /opt/squidstats/
 python3 -m venv "/opt/squidstats/venv"
 source venv/bin/activate
 pip install --upgrade pip
  1. Install requeriments python with pip or pip3:
  pip install -r /opt/squidstats/requirements.txt
  1. Create a .env file in the project root and add the following content:
    Note: for use MARIADB need your own database running
    VERSION=2
    SQUID_HOST="127.0.0.1"
    SQUID_PORT=3128
    FLASK_DEBUG="True"
    DATABASE_TYPE="SQLITE"
    SQUID_LOG="/var/log/squid/access.log"
    DATABASE_STRING_CONNECTION="/opt/squidstats/"
    REFRESH_INTERVAL=60
    BLACKLIST_DOMAINS="facebook.com,twitter.com,instagram.com,tiktok.com,youtube.com,netflix.com"
  2. Run App with python or python3 ๐Ÿš€:
  python3 app.py
  1. With your preferred browser, visit the installation URL:
  http://ip/hostname:5000

โš ๏ธ First Execution Alert โš ๏ธ

Warning: ๐Ÿšจ The first execution may cause high CPU usage.

Update project(web) with Script

  1. Get Script With curl o wget:
 wget https://github.com/kaelthasmanu/SquidStats/releases/download/0.2/install.sh
  1. Add permission execution:
 sudo chmod +x install.sh
  1. Execute the script with parameters update:
 sudo ./install.sh --update

๐Ÿ•’ Run on System Startup To ensure the application starts automatically when the system boots, add the following cron job:

  1. Open with a editor the file crontab
nano /etc/crontab
  1. Add the following line to the crontab file(change path_app for your path):
@reboot root nohup python3 path_app/app.py &
  1. Save

Or can use service(daemon):

  1. Copy file service:
  cp ./utils/squidstats.service /etc/systemd/system/squidstats.service
  1. Restart daemons:
  systemctl daemon-reload
  1. Enable service:
  systemctl enable squidstats.service
  1. Start service:
  systemctl start squidstats.service

Testing Information

This software has been thoroughly tested and is compatible with Squid version 6.12 in Ubuntu 24.04 and Debian12. Please ensure your Squid installation matches this version or newer for optimal performance.

To do

Make blah blah.

Contributing

  1. Fork the repository:
    git checkout -b feature-name
    2.Create a new branch for your feature or fix:
git checkout -b feature-name

3.Commit your changes and push the branch:

git push origin feature-name

4.Open a pull request.

Contributors

Kaelthas Alexminator
kaelthasmanu alexminator

License

The SquidStats project is released under the MIT license.

Contact

Need help? Feel free to contact me ๐Ÿ“จ manuelalberto.gorrin@gmail.com

Project Link: (SquidStats)

Technologies Used

Backend: Python, Flask Frontend: HTML, CSS

Special thanks

  • To the Cuban Sysadmins community.
  • To everyone who gave me his help when I had doubts.

About

SquidStats

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0