Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^8: Question about the most efficient way to read Apache log files without All-In-One Modules from CPAN (personal learning exercise)

by wrog (Friar)
on Jun 18, 2015 at 16:17 UTC ( #1131020=note: print w/replies, xml ) Need Help??


in reply to Re^7: Question about the most efficient way to read Apache log files without All-In-One Modules from CPAN (personal learning exercise)
in thread Question about the most efficient way to read Apache log files without All-In-One Modules from CPAN (personal learning exercise)

  • which says nothing about logname and user,
  • nor does it guarantee that the HTTP command field always consists of exactly 3 space-separated components (hint: it doesn't).
  • Comment on Re^8: Question about the most efficient way to read Apache log files without All-In-One Modules from CPAN (personal learning exercise)
  • Select or Download Code

Replies are listed 'Best First'.
Re^9: Question about the most efficient way to read Apache log files without All-In-One Modules from CPAN (personal learning exercise)
by karlgoethebier (Prior) on Jun 18, 2015 at 17:47 UTC
    "...3 space-separated components (hint: it doesn't)"

    I used this: <LogFormat "%h %l %u %t \"%r\" %>s %b" common>, as in the example by kcott.

    From the docs:

    "First, the method used by the client is GET. Second, the client requested the resource /apache_pb.gif, and third, the client used the protocol HTTP/1.0."

    Hence the request field will always look like this: "GET /karls.beer HTTP/1.0".

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      (yay, somebody is finally quoting the right spec)

      Key sentence you apparently skipped over

      The log file entries produced in CLF will look something like this
      emphasis mine. In other words, this was an example. Not all commands are GETs, and even for the ones that are, you'll still have assholes out there who are not following the protocol (keeping in mind that the whole freaking point of a log file is to preserve what's actually happening so that you can, say, diagnose stuff that's going wrong...)
Re^9: Question about the most efficient way to read Apache log files without All-In-One Modules from CPAN (personal learning exercise)
by BrowserUk (Pope) on Jun 18, 2015 at 17:32 UTC
    nor does it guarantee that the HTTP command field always consists of exactly 3 space-separated components (hint: it doesn't).

    You read the wrong spec, or you misread the right one:

    The Request-Line begins: -- with a method token, -- followed by the Request-URI -- and the protocol version, -- and ending with CRLF. The elements are separated by SP characters. No CR or LF is allowed except in the final CRLF sequence. Request-Line = Method SP Request-URI SP HTTP-Version CRLF

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
    I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!
    div class=
      1. That's the HTTP spec, which is all very nice but is not the Apache Log spec.
      2. Just assuming for the sake of argument that the HTTP command line is indeed being copied verbatim into that field, there's also the question of whether all of the clients out there will be actually following the spec — we live in a world with script kiddies and DDOS hobbyists, after all (hint: I'm guessing there's a reason the Apache folks saw fit to double-quote that field)

      In other news, in my real-live Apache 2.4 webserver using the default-format log, I see lines like this:

      10.54.33.35 - - [18/Jun/2015:09:05:55 -0700] "-" 408 0
        In other news, in my real-live Apache 2.4 webserver using the default-format log, I see lines like this: ...

        Then you've got a problem. (Hint: That would break Apache::Log::Parser amongst most other 'proper parsers')


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
        I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1131020]
help
Chatterbox?
[Discipulus]: thanks choroba.. todo list need a pager..

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2017-11-24 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (348 votes). Check out past polls.

    Notices?