?
Solved

access_log roll over weekly

Posted on 2004-09-28
9
Medium Priority
?
795 Views
Last Modified: 2008-02-26
Hi!

I wonder what strategies there are for monitoring the Apache access_log and to automitically roll over each week.

What is the easiest way if I don't want to install any software, and what is the easiest way if I can install log monitoring tools?

Any help is greatly appreciated!

Thanks in advance!

best regards,

Tom-Erik
0
Comment
Question by:tomerikv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 18

Accepted Solution

by:
liddler earned 600 total points
ID: 12167432
No install. write a little cron script, something like:
#!/bin/ksh
DATE=`date +%d-%b-%y`
mv /usr/local/apache/logs/error_log /usr/local/apache/logs/archive/error_log.$DATE
mv /usr/local/apache/logs/access_log /usr/local/apache/logs/archive/access_log.$DATE
touch /usr/local/apache/logs/error_log
touch /usr/local/apache/logs/access_log
/usr/local/apache/bin/apachectl graceful
gzip /usr/local/apache/logs/archive/error_log.$DATE
gzip /usr/local/apache/logs/archive/access_log.$DATE

For external software look at cronolog http://cronolog.org/
0
 
LVL 1

Author Comment

by:tomerikv
ID: 12167484
Hi again,

Thanks a lot!

I also wonder, if I am to use it on Windows too, are there any chance to do a similar thing on Windows 2000 as well?

best regards,

Tom-Erik
0
 
LVL 18

Expert Comment

by:liddler
ID: 12167507
...probably, using logrotate and maybe schedular.
 have a look at http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_20784813.html
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 15

Assisted Solution

by:periwinkle
periwinkle earned 200 total points
ID: 12169959
Isn't logrotate a Linux/Unix utility?  That would be my recommendation for that platform (especially as you need to restart the web server after rotating the log;  you can easily do so with a post-log rotation command using logrotate).

Perhaps you are thinking of rotatelogs.

Cronolog apparently has a Win32 version as well as a Linux/Unix version - you'll probably be able to do something there with the scheduler.
0
 
LVL 1

Author Comment

by:tomerikv
ID: 12171697
Hi again,

I have now tried rotatelogs

I commented out and added this line to httpd.conf:

# CustomLog logs/access_log common

CustomLog "|C:/Ora_app/Apache/Apache/bin/rotatelogs.exe C:/Ora_app/Apache/Apache/logs/access_log 86400" common

After I made that change Apache won't start.

The HTTP SERVER.1 gave this error:
[Tue Sep 28 19:06:15 2004] [error] (9)Bad file descriptor: dup2(stdin) failed
ap_spawn_child: Bad file descriptor
Couldn't fork child for piped log process

I also tried to move rotatelogs like suggested in:

http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_20784813.html

This did not work either.

Any ideas what is wrong?

best regards,

Tom-Erik


0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12172070
As I understand it, the unable to fork usually is the result of having insufficient permissions to be able to.  Is it possible that the permissions aren't set up properly for the rotatelogs command?
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12172116
This question/answer seems to be extremely relevent:

http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_20784813.html

possibly, you'll have to move the location of your logs?  AAR, you'll need to make certain that the user that Apache runs under has permission to execute the rotatelogs.exe command, and can create and write to files in the directory where the logs are located.
0
 
LVL 1

Author Comment

by:tomerikv
ID: 12174938
Hi,

I also tried this, but I got the same error.

I didn't try to just move the default logging directory without doing any other changes , so I will try this and then update the result when I know if that works.

regards Tom-Erik
0
 
LVL 1

Author Comment

by:tomerikv
ID: 12363576
Hi!

Sorry for the late answer. It did work with rotatelogs, but I had to add a tag in the Oracle opmn.xml file. The error is related to Apache and Win2000:

The fix was:
Steps to correct:
1. Edit $ORACLE_HOME\opmn\conf\opmn.xml
2. Change line:
<ohs gid="HTTP Server"/>
to:
<ohs gid="HTTP Server">
<environment>
<prop name="ComSpec" value="C:\WINNT\system32\cmd.exe"/>
</environment>
</ohs>
3. Restart ProcessManager service and it will work.


Thanks for your help!

best regards,

Tom-Erik




0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question