Fără Descriere

alexminator efeb06876d fix card 1 an în urmă
.idea c17311899e separate code python from sh 1 an în urmă
assets fb0487ae2e move files to static 1 an în urmă
database 243ca50b7d eliminado linea repetida 1 an în urmă
parsers 4f450126a7 🎨 add graphs, script for install and some changes 1 an în urmă
services 3d2a435056 add icons 1 an în urmă
static efeb06876d fix card 1 an în urmă
templates efeb06876d fix card 1 an în urmă
utils c17311899e separate code python from sh 1 an în urmă
.gitignore 6c51a019a0 fix bug cache page 1 an în urmă
LICENSE 7242ab717e Create LICENSE 1 an în urmă
README.md 10c06ed25d fix name package 1 an în urmă
README_es.md b98a805685 fix name 1 an în urmă
app.py 8765584da6 some fix and improved ui 1 an în urmă
install.sh e8ef48a1f7 fix name 1 an în urmă
requirements.txt b6d6cc96ea add mariaDB support and some changes 1 an în urmă

README.md

SQUIDSTAT logo
The definitive analysis for your proxy

[![GitHub repo size](https://img.shields.io/github/repo-size/kaelthasmanu/SquidStats?logo=github&style=plastic)](https://github.com/kaelthasmanu/SquidStats/) [![GitHub License](https://img.shields.io/github/license/kaelthasmanu/SquidStats.svg?logo=github&style=plastic&colorB=68B7EB)](https://github.com/kaelthasmanu/SquidStats/blob/master/LICENSE) [![GitHub stars](https://img.shields.io/github/stars/kaelthasmanu/SquidStats.svg?style=plastic&logo=github&color=yellow)](https://github.com/kaelthasmanu/SquidStats/stargazers) [![GitHub forks](https://img.shields.io/github/forks/kaelthasmanu/SquidStats.svg?logo=github&color=teal&style=plastic)](https://github.com/kaelthasmanu/SquidStats/members) [![GitHub top language](https://img.shields.io/github/languages/top/kaelthasmanu/SquidStats?logo=github&style=plastic&color=blueviolet)](https://github.com/kaelthasmanu/SquidStats/) [![GitHub contributors](https://img.shields.io/github/contributors/kaelthasmanu/SquidStats?logo=github&style=plastic)](https://github.com/kaelthasmanu/SquidStats/) [![Watchers](https://img.shields.io/github/watchers/kaelthasmanu/SquidStats?logo=github&color=teal&style=plastic)](https://github.com/kaelthasmanu/SquidStats/watchers)

:star: 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](https://github.com/kaelthasmanu/SquidStats/tree/main/assets "Examples").**
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
    
  2. Add permission execution:

    sudo chmod +x install.sh
    
  3. Execute the script:

    sudo ./install.sh
    

    Installation Manual

  4. Clone the repository:

    mkdir -p /opt/squidstats
    git clone https://github.com/kaelthasmanu/SquidStats.git /opt/squidstats
    
  5. Creating a virtual environment (venv):

    cd /opt/squidstats/
    python3 -m venv "/opt/squidstats/venv"
    source venv/bin/activate
    pip install --upgrade pip
    
  6. Install requeriments python with pip or pip3:

    pip install -r /opt/squidstats/requirements.txt
    
  7. 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
    
  8. Run App with python or python3 🚀:

    python3 app.py
    
  9. 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
    
  2. Add permission execution:

    sudo chmod +x install.sh
    
  3. 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
    
  2. Add the following line to the crontab file(change path_app for your path):

    @reboot root nohup python3 path_app/app.py &
    
  3. Save

Or can use service(daemon):

  1. Copy file service:

    cp ./utils/squidstats.service /etc/systemd/system/squidstats.service
    
  2. Restart daemons:

    systemctl daemon-reload
    
  3. Enable service:

    systemctl enable squidstats.service
    
  4. 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

<th><b>Kaelthas</b></th>
<th><b>Alexminator</b></th>

<td align="center"><a href="https://github.com/kaelthasmanu"><img src="https://avatars.githubusercontent.com/u/39976595?v=4" width=150px height=150px alt="kaelthasmanu"/></a></td>
<td align="center"><a href="https://github.com/alexminator"><img src="https://avatars.githubusercontent.com/u/9116486?s=400&v=4" width=150px height=150px alt="alexminator"/></a></td>

<td align="center"></a> <a href="https://www.linkedin.com/in/manuel-gorrin-095242238/"><img src="assets/linkedin-48.png" width="32px" height="32px"></a><a href="https://t.me/king_0f_deathhh"><img src="assets/telegram-app-48.png" width="32px" height="32px"></a></td>
<td align="center"><a href="https://twitter.com/alexminator99"><img src="assets/x_48.png" width="32px" height="32px"></a> <a href="https://www.linkedin.com/in/alexander-rivas-73532037/"><img src="assets/linkedin-48.png" width="32px" height="32px"></a><a href="https://t.me/Alexminator"><img src="assets/telegram-app-48.png" width="32px" height="32px"></a></td>

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.