Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: 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 17, 2015 at 10:08 UTC ( #1130780=note: print w/replies, xml ) Need Help??


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)

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 (Prior) 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.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1130780]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2017-12-14 23:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (414 votes). Check out past polls.

    Notices?