Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

access_log roll over weekly

Posted on 2004-09-28
9
Medium Priority
?
800 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

618 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