guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

common log format parser


From: Andy Wingo
Subject: common log format parser
Date: Fri, 02 Sep 2011 00:36:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Hi,

I posted a quick parser for Apache's common log format here:

  https://gitorious.org/guile-clf

Use like this:

    (use-modules (clf))

    (define (counter-analysis)
      (make-analysis (lambda (line count) (1+ count)) 0))

    (call-with-input-file "/var/log/apache2/$site/access.log"
      (lambda (p)
        (analyze-logs! p (list (counter-analysis)))))
    => (#<<analysis> proc: #<procedure ... (line count)> seed: 3020186>)

So, a lot of work just to say there are 3M lines in this file.  Write
your own passes to do other things.  I'll add to it over time, but if
you have an interesting one, send me a pull request ;)

Andy
-- 
http://wingolog.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]