[Tutor] parsing sendmail logs

nibudh nibudh at gmail.com
Fri Jul 18 06:56:24 CEST 2008


2008/7/15 Martin Walsh <mwalsh at groktech.org>:

>  >     Any pragmatic advice on building or working with a framework to get
> >     to the point where i can do analysis on my logs would be cool.
> >
>
>
> As an exercise, I think it would be a reasonable approach to write
> python derivatives of the shell commands being used, perhaps tailored to
> the data set, to get a feel for working with text data in python. Then
> ask questions here if you get stuck, or need optimization advice. I
> think you'll find you can accomplish this with just a few lines of
> python code for each (sort -u, grep, awk '{print $n}', etc), given your
> use of the commands in the examples provided. Write each as a function,
> and you'll end up with code you can reuse for other log analysis
> projects. Bonus!
>
> HTH,
> Marty
>
>
Hi Marty,

Thanks for the input. I like the idea of writing tailored versions of the
standard unix tools. I think what has held me back from writing more than a
few scripts based on someone elses code is a lack of clarity about what i'm
wanting to write.

I've done a bit of web programming in ASP,PHP and Perl mostly in the
presentation layer, but the shift in domain to sysadmin tasks has for some
reason has been difficult.

To essentially re-write "sort -u" in python has the advantage for me that i
use sort _alot_ so i'm familiar with the concept and it's  a small enough
tasks to feel doable. :-)

Your suggestion also provides an insight into how to program that i find
easy to forget. which is to break things down into smaller pieces.

Cheers,

nibuh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080718/594aab06/attachment.htm>


More information about the Tutor mailing list