http://qs321.pair.com?node_id=1130780


in reply to Re^2: 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)

He did ask for a learning exercise; not a pre-solved solution.

Plus, chances are the he'll need to break the composite fields down further anyway, before he can do any analysis or storage.


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". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
  • Comment on Re^3: Question about the most efficient way to read Apache log files without All-In-One Modules from CPAN (personal learning exercise)
  • Watch for: Direct replies / Any replies

Replies are listed 'Best First'.
Re^4: Question about the most efficient way to read Apache log files without All-In-One Modules from CPAN (personal learning exercise)
by karlgoethebier (Abbot) on Jun 17, 2015 at 17:21 UTC
    "...He did ask for a learning exercise..."

    Yes, but i didn't reply to the OP.

    "...break the composite fields down..."

    Yes, sure. Perhaps like this:

    karls-mac-mini:monks karl$ perl -E ' say split /[\[\]]/, qq([22/Apr/20 +15:13:35:04 +1000])' 22/Apr/2015:13:35:04 +1000 karls-mac-mini:monks karl$ perl -E ' say split /"/, qq("GET /bin/admin +.pl HTTP/1.1")' GET /bin/admin.pl HTTP/1.1 karls-mac-mini:monks karl$ perl -E 'say join "\t", split /\s/, qq(GET +/bin/admin.pl HTTP/1.1)' GET /bin/admin.pl HTTP/1.1 # usw...

    I just wanted to show wrog that a solution that only uses split is possible.

    Another question is this it is desirable if this is desirable. I guess some may call it abuse.

    Edit: Better wording.

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      Sorry Karl. My reply was intended as a reply to wrog.

      I must have clicked the wrong link; which from memory is a first for me. I make plenty of other stupid user errors here, but never (that I recall) replying to the wrong post.

      Effectively, I was make the same point as you already did.


      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". I'm with torvalds on this
      In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
        which is a little bit odd, since I don't recall attempting to provide a pre-solved solution myself, but whatever.

        If the point is to provide a learning exercise in how split can bite you in the ass, then fine.

        (or if Apache really does go to some pains to make sure spaces never show up in the various log fields -- say by always representing them as + or %20 -- then yay, but I'm not sure this is actually true.)