Solved

how to check Apache, MySQL and general logs on CentOS

Posted on 2011-09-08
12
686 Views
Last Modified: 2012-05-12
Hi,
On a CentOS 5.x Server

1. How do I check Apache logs for a particular date? e.g. what was the peak of concurrent web requests on this date?

2. MySQL logs for a particular date? i.e.  a list of queries that were running at the time that the load spiked.

3. On a particular date, The traffic was very high and server became non responsive, so to identify what was the bottle neck, how do I check what was the system condition before it became non responsive, using logs?

Thanks
0
Comment
Question by:rajoo_sharma
  • 4
  • 3
  • 2
  • +1
12 Comments
 
LVL 21

Expert Comment

by:Papertrip
ID: 36507930
0
 
LVL 38

Accepted Solution

by:
wesly_chen earned 500 total points
ID: 36508123
1. /var/log/httpd/access_log*
But double check your httpd.conf
grep  CustomLog   /etc/httpd/conf/httpd.conf

2. check the start script for mysqld
egrep  '--log|general_log'   /etc/init.d/mysqld
Usually, by default, the query is not enabled for MySQL.

3. use sar (System Activity Reporter)
It is included in sysstat package
yum  install  sysstat
After a couple minutes or hours(to collect data), then
sar -n DEV   #gives network device stats
0
 
LVL 7

Expert Comment

by:boon86
ID: 36509156
cd /var/log

use: cat <filename>
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 7

Expert Comment

by:boon86
ID: 36509163
here is you search some keyword inside the log:

use: cat abc.log | grep <my keyword>
0
 

Author Comment

by:rajoo_sharma
ID: 36509194
Thanks guys, I'll check and get back.
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36511026
2. for log setting, also check /etc/my.cnf
grep  ^log  /etc/my.cnf


3. for more usage details, do
man sar
   sar can report certain period of time.
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36900837
Hi Rajoo,

Were we able to help resolve this question?
0
 
LVL 7

Expert Comment

by:boon86
ID: 36901401
0
 
LVL 7

Expert Comment

by:boon86
ID: 36901406
ops wrong post
0
 

Author Comment

by:rajoo_sharma
ID: 37205369
Hey guys, apologies for such a delayed response, actually I couldn't check anything since we were terribly stuck in something else. I'll check in a day or two and get back to you again.

Thanks and Regards
0
 

Author Closing Comment

by:rajoo_sharma
ID: 37404955
sysstat gives me what I want, though there were issues and it could not generate the graphs.
So we finally installed Munin and its generating graphs.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWS EC2 HTTP & HTTPS 2 72
list of sudo access for date range 5 34
Syslog-ng works. Now what? How to filter and manage? 8 89
Shrink Linux Swap File Size CentOS 10 19
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question