Git Product home page Git Product logo

squid2radius's Introduction

squid2radius

squid2radius is a tool to analyzes your squid access.log file, display the usage information or send to a RADIUS server using Accounting-Request as defined in RFC 2866.

It may call squid to rotate your log file so that no lines will be counted more than once.

Forked from Bill Zhong's squidlog.

Installation

Clone Git repo

git clone [email protected]:MirageTurtle/squid2radius.git

Usage for Radius

usage: squid2radius.py [-h] [-p RADIUS_ACCT_PORT]
                       [--radius-nasid RADIUS_NASID] [--squid-path SQUID_PATH]
                       [--exclude-pattern EXCLUDE_PATTERN] [--no-rotation]
                       logfile_path radius_server radius_secret

For instance, run like this if you have access log file at /var/log/squid/access.log, RADIUS server running at localhost with secret set to testing123:

python squid2radius.py /var/log/squid/access.log localhost testing123

It is certainly a good idea to make a cron job for this.

You should also read SquidFaq/SquidLogs to make sure your log files are in reasonable sizes.

--exclude-pattern

If for some reason you need to prevent usage information of certain user from being sent to the RADIUS server, there is an argument for that! Use --exclude-pattern="(girl|boy)friend" and squid2radius.py won't send usage of either your girlfriend or boyfriend to the RADIUS server.

--no-rotation

By default squid2radius.py calls squid -k rotate to make squid rotate your log files right after we are done counting usage data, in order to ensure usage data accuracy by not counting any log lines more than once next time you run it. If this is troublesome in your setup, you can add --no-rotation argument to disable this behavior.

Usage for Display

usage: squidlocal.py [-h] [--exclude-pattern EXCLUDE_PATTERN]
                     logfile_path

For example, you have an access log file at /var/log/squid/access.log:

python squidlocal.py /var/log/squid/access.log

--exclude-pattern

If for some reason you need to prevent usage information displayed, there is an argument for that! Use --exclude-pattern="(girl|boy)friend" and squidlocal.py won't display usage of either your girlfriend or boyfriend.

Note

The script assumes that you are using the default Squid native access.log format on first ten columns of your log file. If you need custom columns, add them after the default ones.

squid2radius's People

Contributors

jiehanzheng avatar billzhong avatar mirageturtle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.