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.urwords.railsfactory.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.urwords.railsfactory.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
No comments:
Post a Comment