LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-14-2008, 04:21 AM   #1
turbo_acura
Member
 
Registered: Sep 2004
Location: London, UK
Posts: 95

Rep: Reputation: 15
change /var/log destination


Hello,

I would like to change the filesystem where log files will go (everything that goes into /var/log ).

When I installed Redhat, I didn't setup /var filesystem and now I would like it, but don't think its possible now as the /var directory is under the / filesystem. I worry about if there is a problem and logs fill up my root filesystem. Is there anyway to tell logs for messages, mail and secure to go in another filesystem if I create it? I would think there is some config file in /etc/ or something that tells where log files are put.

Any ideas are much appreciated.

Thanks!
Nigel
 
Old 02-14-2008, 04:42 AM   #2
kiranbyk
LQ Newbie
 
Registered: Jan 2007
Posts: 23

Rep: Reputation: 16
Yes you can do that by editing /etc/syslog.conf file. Look at the file and you will understand it. Restart the syslog service after modifying the file.
 
Old 02-14-2008, 05:16 AM   #3
turbo_acura
Member
 
Registered: Sep 2004
Location: London, UK
Posts: 95

Original Poster
Rep: Reputation: 15
ahh..thats perfect...thank you!!!!
 
Old 02-14-2008, 05:29 AM   #4
rupertwh
Member
 
Registered: Sep 2006
Location: Munich, Germany
Distribution: Debian / Ubuntu
Posts: 297

Rep: Reputation: 49
Quote:
Originally Posted by turbo_acura View Post
When I installed Redhat, I didn't setup /var filesystem and now I would like it, but don't think its possible now as the /var directory is under the / filesystem.
It's not only possible but also easy. Provided that you have space left for a new partition.

The basic steps are:
  1. Create/format partition
  2. Temporarily mount new partition, e.g. on /mnt
  3. Move data from /var to /mnt
  4. umount, then mount new partition on /var. (And edit /etc/fstab to mount automatically)
 
Old 02-14-2008, 06:14 AM   #5
atom
Member
 
Registered: Feb 2004
Location: Slovenia
Distribution: archlinux
Posts: 271

Rep: Reputation: 31
Make sure that you delete the old logfiles before remounting (POSIX file deletion semantics should let you do that without disrupting your system), so you don't end up with a bunch of large files (I've seen logs more than 10GB thick) that you can't access because the partition is mounted over the past var directory.
 
  


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
Bash script for server log (namely var/log/messages) tenaciousbob Programming 17 05-24-2007 10:43 AM
/var/log/packages and /var/log/setup sunny_5252 Slackware 4 05-17-2007 08:17 PM
Deleted /var/log/messages, can't log any files-iptables chingyenccy Linux - Newbie 7 02-27-2005 04:03 PM
Strange results in /var/log/apache/access.log subt13 Linux - Security 2 08-03-2004 01:21 PM
iptables, changing log file from /var/log/messages acid2000 Linux - Networking 3 03-11-2003 08:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:38 PM.

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