iMail Session Grabber

by Dave Shpritz, Edgewebhosting.net

Introduction

The idea was simple really. We deal with a lot of large iMail log files. We would often get requests from customers about missing emails, sent emails, etc. and would spend hours slaving over a hot grep, finding the answers. The log files on our mail servers get large enough that they can be more than a little clumsy to deal with. As a result (and the fact that I was teaching myself Python at the time) we came up with this little script to help simplify things a little.

You give the script a filename and an email address to look for and it will go through the file and find all of the sessions that involve that email address. Note that the email address is not hard and fast, and in fact you can pass it any search string. It will then loop through the file again and get all of the log file entries that involve those sessions and prints them out (including line numbers if you wish). This allows you to get session history for an email address which can be very useful when trying to answer customer problems or debugging an email problem.

Usage

Very simple. You will need Python (it was written in Python 2.5) if you wish to use the raw script. If you use the compiled version for Win32, they you do not need Python installed.

In addition you will need an iMail log file, and a search string

You run the scipt like so:

python imailsessiongrabber.py -e user@host.com -f c:\imail\sys0808.txt

For the exe:

imailsessiongrabber -e user@host.com -f c:\imail\sys0808.txt

There is also a "-l" (that's an l as in linux) option which will include the line number that the log entry was found on.

License

This script and the exe are offered under a BSD style license as follows:

Copyright (c) 2007, Edgewebhosting.net

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Download

Ahh yeah. The good stuff. But first the legal:

BY DOWNLOADING THESE FILES YOU ARE AGREEING TO THE LICENSE ABOVE.

Now that that is out of the way:

Source/Script

Win32 compiled version Compiled using py2exe.

Problems? Bugs? Thank yous?

Feel free to contact me at . I will do what I can.

Python Powered Valid XHTML 1.0 Transitional Valid CSS!