Clear Error Log Apache Ubuntu
Contents |
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn ubuntu php error log more about Stack Overflow the company Business Learn more about hiring developers or ubuntu mysql error log posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer
Linux Apache Error Log
site for Ubuntu users and developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise
Clear Apache Error Log Windows
to the top Ubuntu clear Apache2 error log [duplicate] up vote 0 down vote favorite 1 This question already has an answer here: When using sudo with redirection, I get 'permission denied' 5 answers I am new to Ubuntu. I can find my error log here in var/log/apache2/error.log. but i couldn't clear it. i tried to change the permission to edit the content. But couldn't achieve it. Please help me clear apache logs windows to remove it. I have read some question previously asked. but it does-not help me . this one I read http://askubuntu.com/questions/574725/how-to-clear-system-logs-in-ubuntu. Here is my terminal screen-shot: permissions apache2 error-handling share|improve this question edited May 18 at 9:52 Pierre.Vriens 6671615 asked Dec 5 '15 at 5:33 Kvvaradha 1299 marked as duplicate by David Foerster, Eric Carvalho, Videonauth, RPi Awesomeness, muru May 19 at 20:15 This question was marked as an exact duplicate of an existing question. Please post text files and program output listings as text, not as images (see How do I save terminal output to a file?). –David Foerster May 18 at 8:42 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote accepted Most files in /var/log are owned by root. So, if you want to modify them, you will have to use sudo. To clear the error file, give command: sudo bash -c 'echo > /var/log/apache2/error.log' If that doesn't work, then very likely the apache process keeps the file locked and you have to stop apache before you can clear the file. This goes as follows: sudo service apache2 stop sudo bash -c 'echo > /var/log/apache2/error.log' sudo service apache2 start Note: You can't use sudo echo >
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings
Clear Apache Access Log
and policies of this site About Us Learn more about Stack Overflow the clear apache logs without restarting company Business Learn more about hiring developers or posting ads with us Server Fault Questions Tags Users Badges apache logrotate Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody http://askubuntu.com/questions/706128/ubuntu-clear-apache2-error-log can ask a question Anybody can answer The best answers are voted up and rise to the top Can not truncate / clear error.log on apache, but can do it manually with nano up vote 4 down vote favorite 3 I tried to clear the content of error.log file on my apache server with commands sudo >error.log sudo truncate -s0 error.log http://serverfault.com/questions/582758/can-not-truncate-clear-error-log-on-apache-but-can-do-it-manually-with-nano But in both cases I got -bash: error.log: Permission denied. I tried the same thing while stopping apache, but still got the same message. After that I tried to clear it with sudo nano error.log and was able to remove everything. So why was not I able to clear the log properly? log-files apache-2.4 share|improve this question asked Mar 18 '14 at 0:39 Salvador Dali 32021126 add a comment| 1 Answer 1 active oldest votes up vote 11 down vote accepted You should try this : sudo sh -c ">/var/log/apache2/error.log" share|improve this answer answered Mar 18 '14 at 0:47 krisFR 7,35821025 Can you please explain what does this command do? –Salvador Dali Mar 18 '14 at 0:47 It runs an inline sh (shell) command under sudo context. Actually this inline sh command clears Apache error log (as you know) –krisFR Mar 18 '14 at 0:50 1 My guess is that > is not a command without an interpreter like sh or bash –krisFR Mar 18 '14 at 0:59 1 However your sudo truncate... command should work...That i
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow http://stackoverflow.com/questions/9569284/clearing-large-apache-domain-logs the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Clearing Large Apache Domain Logs up vote 5 down vote favorite 1 I am having an issue where error log Apache logs are growing out of proportion on several servers (Linux CentOS 5)... I will eventually disable logging completely but for now I need a quick fix to reclaim the hard disk space. I have tried using the echo " " > /path/to/log.log or the * > /path/to/log.log but they take too long and almost crash the server as the logs are as large as 100GB Deleting the files works fast but apache error log my question is, will it cause a problem when I restart apache. My servers are live and full of users so I can't crash them. Your help is appreciated. linux apache share|improve this question edited Mar 5 '12 at 15:36 kev 70.4k21141185 asked Mar 5 '12 at 15:31 Harry Andrei 156227 >/path/to/log.log will make the file empty. –kev Mar 5 '12 at 15:37 You should never disable logging. You'll need that info someday. Just turn on logrotate. It'll solve the issue while still giving you recent logs for stats and forensics. –Kirby Todd Mar 5 '12 at 15:48 add a comment| 3 Answers 3 active oldest votes up vote 20 down vote Use the truncate command truncate -s 0 /path/to/log.log In the longer term you should use logrotate to keep the logs from getting out of hand. share|improve this answer edited Mar 5 '12 at 15:44 answered Mar 5 '12 at 15:38 Kirby Todd 7,57931953 You seem to know exactly what you are talking about but just to reiterate, this truncate command should not require huge amounts of CPU to truncate the file... as previous attempts as mentioned before were not quite pleasant... Thank you for your help. –Harry Andrei Mar 5 '12 at 15:57 My l