Visualizing Login Sessions through Gantt Charts
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle
images
src/main/java/log2gantt
.gitignore
README.md
build.gradle
license-LGPL.txt

README.md

log2gantt logo log2gantt

creates gantt charts to visualize the time and duration of login sessions on a linux/unix system.

Example:
log2gantt screenshot

Features

  • parses log files as /var/log/auth.log
  • creates a gantt chart with a bar for each user showing the time and duration of his/her logins
  • output as png or jpeg

Requirements

  • Java 1.5 or later

License

The content of this project is licensed under the GNU Lesser GPL.

Quickstart

  • build executing gradle and find the executable jar in build/libs
  • execute on the command line:
    java -jar build/libs/log2gantt-*.jar -i /var/log/auth.log)
  • eventually include it in a cron job and send the output image by mail to the server admin

Usage

See the full list of command line arguments by executing java -jar log2gantt-*.jar --help

usage: java log2gantt.AuthLog2Gantt [options]<br>
where options include:<br>
-i logfile        the input logfile to parse (default: auth.log)<br>
-o imagefile      the output image file to write (default: auth_log_gantt.png)<br>
-w width          the width of the output image (default: 600) [pixels]<br>
-h height         the height of the output image (default: 0) [pixels]<br>
-t title          the title in the output image (default: null)<br>
-f                to force overwriting the output file (default: false)<br>

Integrating log2gantt into Logcheck

For a daily update about what's happening on our server we integrated log2gantt in the Logcheck script which is executed daily by cron.

In the script we call log2gantt after the file auth_check.$$ was created by inserting the following lines

JARFILE=$(ls -1 /usr/local/log2gantt/log2gantt-*.jar | sort | tail -n 1)
java -Xmx30m -jar $JARFILE -i $TMPDIR/auth_check.$$ -o $TMPDIR/auth_gantt_$$.png -f

To attach the gantt graph picture to the result mail we inserted -a /$TMPDIR/gantt_chart_$$.png after the two $MAIL commands at the end of the script (we use mutt as mailer).

Finally we let cron execute the Logcheck script daily by executing the command

> ln -s /usr/local/bin/logcheck.sh /etc/cron.daily/logcheck.sh