Parsing '500' status code with Unix command line tools

Alles, was den Apache betrifft, kann hier besprochen werden.

Parsing '500' status code with Unix command line tools

Postby 5kKate » 15. April 2015 19:48

Here is an example of one of my raw Apache logs:

Code: Select all
10.185.248.71 - - [09/Jan/2015:19:12:06 +0000] 808840 "GET /inventoryService/inventory/purchaseItem?userId=20253471&itemId=23434300 HTTP/1.1" 500 17 "-" "Apache-HttpClient/4.2.6 (java 1.5)"


I want to parse out the '500' status code. I'm using Unix command line tools, and I'm not sure if I should use grep or the 'cat'/'cut' method. I'd like as few false positives as possible.
5kKate
 
Posts: 1
Joined: 05. April 2015 03:44
Operating System: Ubuntu

Re: Parsing '500' status code with Unix command line tools

Postby Nobbie » 16. April 2015 11:27

You cannot use "cat", this does not filter anything.

You can use grep, this may filter the messages, but it does no parsing (if you really mean "parsing").
A light parsing command is "sed" (streamedit), a very powerfull and sophisticated one is "awk".

Anyway, this is the wrong forum for you, its not meant for straight linux support, but for Apache. Go for some linux tutorials and/or some linux forums.
Nobbie
 
Posts: 8775
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 3 guests