Help - Search - Members - Calendar
Full Version: How to Delete Apache Log Files Manually
The Planet Forums > System Administration > Server Hardware > RaQ Support
lch_hosting
On my Plesk server I set all log files to never be deleted.... I would like to know how to do so manually (how to delete the users log files) however I have over 700 domains, so I would like to be able to run one command that would delete them all, can this be done??
ranganc
Yes it is possible. Stop the apache go to usr log dir manually then
issue the following echo > access_log then start the apache.

If you to to it for 700 odd domains in one strech, you may have to write a shell script which does the same.


The advantage of this method is since plesk doesnot support daily log rotation, we can use this method to implement log rotation

If you have any further doubts please contact me

trivandrum@rediffmail.com

Thanks
sacplin
so you need to clear those logs files.

yes you do use echo. but i don't think you need to stop apache to do this. will i don't. stopping apache will make sites inactive until restarted. what happens if you can't get it restarted. noooooooo.

use this echo command to clear log will apache is running.

echo " "> /path/to/access_log

example:

echo " "> /var/log/httpd/log/access_log

another example:

echo " "> /usr/local/apache/logs/error_log

you can do this while apache is running.

i am working on a shell script to manage a redhat server. reading, rotating, and clearing log files is just one of the options. the release will be in a few months. just testing it on a server now.
ranganc
Hello,

Thanks, it works without stopping apache. Please let us know when you are done with your server management script.


Thanks
Rangan C
sacplin
i am glad it works for you with out stopping apache. the main reason you will need to stop and start apache is when you add ssl for a domain. most of the other times you do not need to stop and start apache.

the server script is coming along great. i just added a section where administrators can check user passwords. when you run check user passwords; it will check to see what users are using dictionary words. the easiest way hackers can get into a system is cracking easy passwords. you may not know what users a using for their passwords, but you can tell if they are using dictionary or names for passwords. then it will give you the option to change a user password that was cracked.

this is just one of the many options. here are some more options.

1. system disk usage
2. list users
3. user disk usage
4. read log files
5. backup log files (rotate)
6. clear log files
7. reboot server
8. ssh to other system
9. download files from websites
10. automatic install of perl modules
11. dns entry for users
12. edit dns for users
13. delete account
14. stop start and status of apache
15. backup apache configuration file
15. edit apache conf file
16. restore httpd.conf
17. download install pmfirewall
18. download install mysql
19. download install DBD and DBI driver
20. download install apache web server with ssl (complete install)

there are many more features and more i want to add before releasing SACP (server administration control panel)

also i want to place a tutorials section in the program.

SACP can only be run in ssh and only by root. SACP is complete menu driven in the shell. also it will not be boring one color. i have added color to the script. no more plain white text on black background.

this should be done in a few months. sorry for the delay. my goal is to have the best shell driven control panel for servers. also my goal is to have Linux Magazine do an article on it like they do for the apache web tool written by someone else. i will release it here first.

the main thing is for me to test it on a production web server of my own first. have to get any bugs out.

all ideas are welcome. i need to build a website for sacp soon.

thanks,

chris
ranganc
Hello Chris,

It really looks like a great set scripts which will be really usefull for administrator.

All the best for your venture.

Surely I will pass on any information which i come across and which I feel very useful for you.

Thanks
Rangan C
AdamS
QUOTE (sacplin)
...what happens if you can't get it restarted. noooooooo...

Why would it not restart?

If that happens, you have a bigger problem then cleaning logs... cool.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.