HTTP Status Codes

* 200 OK: everything went awesome.

* 304 Not Modified: there was no new data to return.

* 400 Bad Request: your request is invalid, and we’ll return an error message that tells you why. This is the status code returned if you’ve exceeded the rate limit (see below).

* 401 Not Authorized: either you need to provide authentication credentials, or the credentials provided aren’t valid.

* 403 Forbidden: we understand your request, but are refusing to fulfill it. An accompanying error message should explain why.

* 404 Not Found: either you’re requesting an invalid URI or the resource in question doesn’t exist (ex: no such user).

* 500 Internal Server Error: we did something wrong. Please post to the group about it and the  team will investigate.

* 502 Bad Gateway: returned if Application is down or being upgraded.

* 503 Service Unavailable: the Applicationservers are up, but are overloaded with requests. Try again later

Handling log files with Cygwin

How to handle log Files with the help of Cygwin?

The following steps are useful to guide that way,

1. Install Cygwin in your pc

Url: http://www.cygwin.com/mirrors.html

2. Download your production log file.

Ex: I am using FileZilla to download log file. If u want to install Filezilla in ur Pc then got this site and get it.

URL http://sourceforge.net/project/showfiles.php?group_id=21558

3. After getting the production.log file Paste that one to the follwingpath.

c:\cygwin\ home\SYSTEMNAME\(PASTEHERE) production.log

Handling CYGWIN:

Log file contains ..,

Processing ContentController#browse (for 122.164.50.158 at 2007-08-04 00:09:05) [GET]
Session ID: 326960cad4b49605ba7dcf9c33a9c94e
Parameters: {“action”=>”browse”, “controller”=>”content”}
Rendering within layouts/main
Rendering content/browse
Completed in 0.64700 (1 reqs/sec) | Rendering: 0.33623 (51%) | DB: 0.19639 (30%) | 200 OK [http://www.project.com/]

Processing UserController#login (for 122.164.50.158 at 2007-08-04 00:09:08) [GET]
Session ID: 326960cad4b49605ba7dcf9c33a9c94e
Parameters: {“action”=>”login”, “controller”=>”user”}
Rendering within layouts/main
Rendering user/login
Completed in 0.03070 (32 reqs/sec) | Rendering: 0.02847 (92%) | DB: 0.00057 (1%) | 200 OK [http://www.project.com/user/login]

Error Types

200 means — ok

304 means — not modified

401 means — unauthorized

403 means — forbidden

404 means — file not found

500 means — Application error etc..

Commands:

1. Run cygwin exe

2. all hits with session id

$ grep ‘Session ID:’ production.log

3. unique session g

$ grep ‘Session ID:’ production.log | sort | uniq

4. number of unique sessions

$ grep ‘Session ID:’ production.log | sort | uniq | wc -l

5. usage of session

$ grep ‘Session ID:’ production.log | sort | uniq -c| sort -r

6. get IP info

$ grep ‘Processing’ production.log | cut -d’ ‘ -f4 |sort | uniq -c| sort -r

7. requests per second

$ grep ‘reqs/sec’ production.log | cut -d’ ‘ -f4 |sort | uniq -c| sort -r

$ grep ‘reqs/sec’ production.log | cut -d’ ‘ -f4 |sort | uniq -c| sort -r > speed.txt (Now see ur c:\cygwin\home\pcname\speed.txt file is there. It contains the particular output.)

$ grep ‘reqs/sec’ production.log | cut -d’ ‘ -f4| cut -d'(‘ -f2 |sort | uniq -c

8. status errors

$ grep ‘(404 Not Found)’ production.log | wc -l
$ grep ‘(500 Error)’ production.log | wc -l

9. Completed

$ grep ‘Completed’ production.log | cut -d’ ‘ -f17 | cut -d'[‘ -f2 | cut -d’]’ -f1

$ grep ‘Completed’ p.log | cut -d’ ‘ -f17 | cut -d'[‘ -f2 | cut -d’]’ -f1 | sort -r | uniq > url.txt

Ya In this way, you will find the status of your product. I think it is very useful to everyone to reduce bugs.

Regards,

P.Raveendran