LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2016, 04:39 AM   #1
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Rep: Reputation: Disabled
CentOS7 error logs / system logs


I am running a dedicated server on the latest version of CentOS7. I am using it for running 6 websites, based on different script (pinterest clone script, tube script, picture galleries script, vBulletin forum, Wordpress blogs). The overall traffic to the sites is low, only about 1,000 hits per day (if not less at this point).

I rsynced all the sites to here, moved the database files also, and I would be trying to get a general view of how everything works and if it works correctly, here. I am having some issues with vBulletin connecting to a MariaDB database now, one other thing does not work, and I will be checking for other errors too.

In general, I would like to run the sites for like 24 hours, lets say, and get a good general view of the system, and what is going on. What error logs (besides the most obvious /var/log/httpd/error_log; I only use Apache, I dont have Nginx or anything else here) would I check to get a good info, and also what default settings should I change? For example, I have an issue with the MariaDB, and this does not log any info by default, as far as I know (I looked into /var/log/mariadb/mariadb.log, and there is nothing there). I started reading about it on the Net and people mention journalctl (command), but no good info there for this.

This is probably all very easy in the end, but it would be helpful to set up things in a certain way.
So how would I get that good view of what is going on, and knock of all the errors / issues, and things like this..

1) httpd error_log - this is the first place to go
2) Enable MariaDB logging in some way, change the default settings. Would you know about any good articles about it on the Net, something that I could follow and use
3) journalctl command, would this be of any use, how?
4) Are there any other places that I would check?

I have logwatch installed, and I get an email everyday, but I have not been using this program too much yet (I am fairy new to all this).

So in general, the latest CentOS7, not a bad hosting plan (SoYouStart.com, $42 per month), 6 websites on different scripts (good quality, except for one, 1,000 hits), and I want to get the full view of what is going on, and probably fix some things.

###Edit:
I could probably switch the logging level in /var/log/httpd/error_log. One script is not very good, and there is a lot of PHP notices there, I probably have close to 500,000 or more lines there after several days of logging. So if it would be better to change the logging level so I have only the most important info, this would be good too, but I am not sure if this is a recommended thing.

This is probably all very easy in the end, but it would be good to set up these things in a certain way, and work on it in a certain way too. Set it up good, check certain places once per day at the beginning, look at the info there, fix the issues, and dont even come back to it after this is done. Maybe check the logwatch emails every couple of days (with this traffic), or even less.

Last edited by AdultFoundry; 06-22-2016 at 04:51 AM.
 
Old 06-22-2016, 05:20 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,461

Rep: Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552
Ensure that the sysstat package is installed, sar is good for getting an idea of system loads across different times of the day.
 
Old 06-22-2016, 05:52 AM   #3
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
MariaDB logging is disabled by default, as the sources say on the Internet. From what I've been working on now, it logs [mysqld_safe] to /var/log/mariadb/mariadb.log by default / out of the box. I've been reading some sources on the Net now (I will put the links on the bottom), and based on that I did that.

I have MariaDB error log for [mysqld_safe] and [mysqld] going to a new file called /var/log/mariadb/mariadb_error.log
I have enabled a slow query log going to /var/log/mariadb/mariadb_slow.log, with the following settings:
Code:
slow_query_log_file = /var/log/mariadb_slow.log
long_query_time = 2
log_queries_not_using_indexes = 1
I did not enable the General Query Log, as this logs the MariaDB queries, and this may not be needed, considering the fact that this is taking a lot of unnecessary storage space.

So this part can be definitely tuned, as you have error log for Apache, and now you have a general error log for MariaDB which does not work on the system out of the box.

So MariaDB is in general - Error Log, General Query Log, Slow Query Log (and this comes with mysqld_safe, mysqld, not just one thing). The third one can be enabled too.

###
@TenTenths - I used to have sysstat on the previous system, but I have omitted it here, I may install it later on. This may be useful when I have more traffic, and not just like 1,000 people per day. The more I install the more resources it uses too.

Last edited by AdultFoundry; 06-22-2016 at 05:55 AM.
 
Old 06-22-2016, 06:02 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,461

Rep: Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552Reputation: 1552
Quote:
Originally Posted by AdultFoundry View Post
@TenTenths - I used to have sysstat on the previous system, but I have omitted it here, I may install it later on. This may be useful when I have more traffic, and not just like 1,000 people per day. The more I install the more resources it uses too.
sysstat/sar has a minimal resource "impact". Number of users has nothing to do with what happens "behind the scenes", for example here's the SAR output from a server that doesn't have any users: Care to guess when the database backup script runs?

Code:
# sar
Linux 3.10.0-327.el7.x86_64 ([renoved])       22/06/16        _x86_64_        (8 CPU)

00:00:01        CPU     %user     %nice   %system   %iowait    %steal     %idle
00:10:01        all      0.02      0.00      0.01      0.00      0.01     99.96
00:20:02        all      5.61      0.00      0.48      1.82      0.03     92.06
00:30:01        all      6.24      0.00      0.09      0.12      0.01     93.54
00:40:01        all      0.01      0.00      0.01      0.01      0.01     99.95
00:50:01        all      0.01      0.00      0.01      0.00      0.01     99.97
01:00:01        all      0.01      0.00      0.01      0.00      0.01     99.97
01:10:01        all      0.07      0.00      0.03      0.03      0.03     99.84
01:20:01        all      0.11      0.00      0.04      0.00      0.05     99.79
01:30:01        all      0.06      0.00      0.02      0.00      0.03     99.89
01:40:02        all      0.01      0.00      0.01      0.00      0.01     99.96
01:50:01        all      0.02      0.00      0.01      0.01      0.01     99.96
 
Old 06-22-2016, 06:08 AM   #5
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
yum install sysstat done. I've been getting deeper into these things before. I read the entire:

http://www.apress.com/9781590593004

which was kind of hard to read, but good. This is suppose to be coming out also:

https://www.amazon.com/Apache-Cookbo...che+web+server

The links for turning on the MariaDB error logging (probably one of the best that are out there) are:

http://www.pontikis.net/blog/how-and...ble-mysql-logs
http://stackoverflow.com/questions/5...files-in-mysql

Also this for /etc/my.cnf:

http://www.fromdual.com/mysql-configuration-file-sample
 
Old 06-22-2016, 06:16 AM   #6
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
Ok, maybe I can get any info about that. I used to have a vBulletin 5 (the latest version) forum on a good managed hosting plan (shared). I did a mysqldump from ssh chroot jail (not that it matters), and I imported it with mysql -u -p <database_name> < file_name.sql. I got an error like this:

Code:
ERROR 2006 (HY000) at line 23048: MySQL server has gone away
This was suppose to be related to max_allowed_packet setting in /etc/my.cnf, so I changed that to like = 500M, and the import worked. The script does not seem to be working with the database though. MariaDB is working and the config file (database connection details) is correct / good.

The vBulletin database stores the actual image files in the database files, and this is how it was set on the previous hosting and here too (I did not change any settings at any time) so this is something new too. The error / issue may be related to this, but I am not sure. In the end I exported and imported the database without any errors / issues after this setting was changed, but it now does not work. I have a topic on their support forum too.

I've been basically stuck for like 10 days now, doing different things like this, and I would like to come back to working on the sites... But also, check all the sites, make sure that everything works (I have more things that dont work too).
 
Old 06-22-2016, 07:10 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by AdultFoundry View Post
I've been basically stuck for like 10 days now, doing different things like this, and I would like to come back to working on the sites... But also, check all the sites, make sure that everything works (I have more things that dont work too).
More things that don't work? Make a list. Welcome to SysAdminLife. Make Coffee.
What does "working on sites" mean if they are up and running? Aren't you the pr0n editor-in-chief?

You're stuck because it's not clear if you ever had a plan.
Wordpress migrations are always problematic.

For Wordpress "testing" an old site on a new host.
On the new host for wordpress, edit /etc/hosts and append this to the contents.
Code:
xxx.xxx.xxx.xxx domain.tld
where xxx. is the new IP of the wordpress site.
save and exit /etc/hosts

Edit wp-config.php of the site on the new host:
Add
Code:
define('WP_HOME','http://domain.tld');
define('WP_SITEURL','http://domain.tld');
You may have to do a "search and replace" on the post content after the import.
I use https://interconnectit.com/products/...ess-databases/
Sometimes it takes more than one import.

Changing http://old_domain.tld with http://domain.tld using that tool.
On your local machine, I usually add the same line to my /etc/hosts:
Code:
xxx.xxx.xxx.xxx domain.tld
just to keep everything pointed at the new host.

This method of editing /etc/hosts I've heard referred to as "poor man's dns" and it works if
done correctly.

Good Luck.

Last edited by Habitual; 06-22-2016 at 07:12 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Back up logs file and create a script showing the backed up logs and the running logs Billy_6052 Programming 5 12-13-2014 02:32 AM
Enable Audit logs to send logs to syslog-ng (remote server) Iyyappan Linux - Server 5 01-07-2014 04:15 PM
logs are not generating inside sftp logs, while acitive directory users are loggin in deepak_message Linux - Server 6 03-24-2013 11:37 AM
Where are the X Windows System error logs located? cbj4074 Linux - Software 4 02-03-2005 07:35 AM
Firefox logs user out? Where are error logs? case1984 Linux - General 0 10-09-2004 02:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration