Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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 ( [id://1130843]=note: print w/replies, xml ) Need Help??


in reply to Re^3: 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..."

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»

Replies are listed 'Best First'.
Re^5: Question about the most efficient way to read Apache log files without All-In-One Modules from CPAN (personal learning exercise)
by BrowserUk (Patriarch) on Jun 17, 2015 at 18:10 UTC

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

        then yay, but I'm not sure this is actually true

        Read the spec.


        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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1130843]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-03-29 14:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found