LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-10-2014, 12:27 AM   #1
skoda
Member
 
Registered: Jun 2013
Posts: 111

Rep: Reputation: Disabled
Clearing Logfiles


Hai Folks

Quote:
./home/virtfs/kammali/usr/local/apache/logs/error_log: 278M
how do i clear the contents of the above log file from bash shell?
 
Old 11-10-2014, 01:32 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

what do you mean my "clear"? Perhaps you want to delete the file? If so you should probably stop apache them "rm" the file and restart apache (this is assuming that the apache process that writes that file is currently running).

Evo2.
 
Old 11-10-2014, 02:16 AM   #3
skoda
Member
 
Registered: Jun 2013
Posts: 111

Original Poster
Rep: Reputation: Disabled
actually i want to clear the contents of the file.
 
Old 11-10-2014, 02:27 AM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,
Quote:
Originally Posted by skoda View Post
actually i want to clear the contents of the file.
Ok, then how about:
Code:
cat /dev/null > /home/virtfs/kammali/usr/local/apache/logs/error_log
Evo2.
 
Old 11-10-2014, 03:15 AM   #5
skoda
Member
 
Registered: Jun 2013
Posts: 111

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by evo2 View Post
Hi,

Ok, then how about:
Code:
cat /dev/null > /home/virtfs/kammali/usr/local/apache/logs/error_log
Evo2.
it says
Quote:
bash .... Read-only file system
 
Old 11-10-2014, 03:28 AM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

you'll need to mount it writeable.

Evo2.
 
  


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
Unix-logfiles khanzadeh.mah Linux - Server 2 12-20-2010 02:43 PM
RHEL 5.* logfiles MeeLee Linux - Newbie 3 08-25-2009 10:15 AM
mysql logfiles cccc Debian 1 02-24-2009 09:00 AM
how to monitor logfiles ganninu Linux - General 4 12-07-2003 07:36 AM
Logfiles wonderpun Linux - General 3 09-01-2002 04:27 AM


All times are GMT -5. The time now is 06:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration