Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to rotate apache log files in day.

Posted on 2003-10-31
8
Medium Priority
?
31,298 Views
Last Modified: 2012-06-27
I tried to add

TransferLog "|rotatelogs /logs/access.log 86400"

to http.conf file.But the http service can not startup.I use windows 2000 advanced server & IBM http server (Apache 2.0.42.2).Did anyone meet this problem before?

Any advise will be appreciated.

yunfeng
0
Comment
Question by:yunfengex
[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
8 Comments
 
LVL 8

Expert Comment

by:heskyttberg
ID: 9670148
Hi!

You cannot do it like that, read Apache manual on LogFormat, TransferLog and related.

TransferLog:
This directive has exactly the same arguments and effect as the CustomLog  directive, with the exception that it does not allow the log format to be specified explicitly or for conditional logging of requests. Instead, the log format is determined by the most recently specified LogFormat directive which does not define a nickname. Common Log Format is used if no other format has been specified.
-----

You should do something like this:
CustomLog "|X:/apache/apache2/bin/rotatelogs.exe
X:/www_logs/www.server.de_%y%m%d.log 86400" combined env=!dontlog

Or use some sort of third party software to do logrotate.
In windows I don't think you need to restart or reaload apache service.

This might be possible for you to do though it will require you to install perl and maybe a few cpan modules.
http://www.serverwatch.com/tutorials/article.php/10825_1129851_2

Try the customLog above first, change drives and paths to suit your environment.

Regards
/Hasse
0
 

Author Comment

by:yunfengex
ID: 9675738
I tried the customlog but still failed.What I added is
CustomLog "|D:/IBMHTT~1.0/bin/rotatelogs D:/IBMHTT~1.0/logs/esdzc-access.log 86400".
I think it conform to directive grammar.

For second solution,frankly,I don't hope to use perl because I have no experience on perl.

Yunfeng
0
 

Author Comment

by:yunfengex
ID: 9676192
I tried to add
CustomLog "|D:/IBM HTTP Server 2.0/bin/rotatelogs.exe D:/IBM HTTP Server 2.0/logs/esdzc-access.log 86400" common

And get the error message from apache console:
unable to start piped log program 'D:/IBM HTTP Server 2.0/bin/rotatelogs.exe D:/
IBM HTTP Server 2.0/logs/esdzc-access.log 86400': 拒绝访问。
Unable to open logs
0
Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

 

Author Comment

by:yunfengex
ID: 9676209
tried to add
CustomLog "|D:/IBM HTTP Server 2.0/bin/rotatelogs.exe D:/IBM HTTP Server 2.0/logs/esdzc-access.log 86400" common

And get the error message from apache console:
unable to start piped log program 'D:/IBM HTTP Server 2.0/bin/rotatelogs.exe D:/
IBM HTTP Server 2.0/logs/esdzc-access.log 86400': Access denied.
Unable to open logs
0
 
LVL 8

Accepted Solution

by:
heskyttberg earned 500 total points
ID: 9676896
Hi!

Ok, make sure the user running Apache have write permissions to D:/IBM HTTP Server 2.0/logs/.
Make sure that this file exists: D:/IBM HTTP Server 2.0/bin/rotatelogs.exe
Also check permissons on this file.

If all is ok, do the following. Create a dir on d: called weblog.
Make sure apache user can write here. Copy rotatelogs.exe to d:\weblog.

And change the CustomLog to look like this:
CustomLog "|D:/weblog/rotatelogs.exe D:/weblog/esdzc-access.log 86400" common

If this works then there is a issue with spaces in path name for CustomLog directive.

Make sure Apache user have right to execute the rotatelogs exec.

Regards
/Hasse

0
 

Author Comment

by:yunfengex
ID: 9711820
Hasse,

To me surprised,apache seems only to recognze one level directory from root.That is , if I use CustomLog "|D:/weblog/rotatelogs.exe D:/weblog/esdzc-access.log 86400" common,OK;but if I use
CustomLog "|D:/weblog/www/rotatelogs.exe D:/weblog/esdzc-access.log 86400" common,it failed to start.Anyway,the rotatelogs works now.Thank you very much!

Yunfeng



0
 

Expert Comment

by:JVirumbi
ID: 11158479
Hi,

We are running Apache 1.3.12.
In order to user rotatelogs.exe, I added this line in the httpd.cong commenting the previuos line:

CustomLog "|D:/rw70/RWWebdriver/apache/bin/rotatelogs D:/rw70/RWWebdriver/log/webdriver/apache/rwweb_access.log 86400" common

But apache fails to start.
I have the rotatelogs.exe in the right place.
I have the folder structure created for the log file.
The error as follows:
ap_spawn_child: Bad file descriptor
Couldn't fork child for piped log process

But If I download from apache site, version 1.3.29, roattelog is working.

So, I have replaced old Apache.exe and ApacheCore.dll with new ones taken from version 1.3.29 in my APACHE_HOME folder.
Also added newly Win9xConHook.dll file to the HOME.

It's working and seems no problem.

is that OK ??

or is there any tutorial to do a formal upgrade
 If so plz help me to get it.

Thanks & Rgds  
0
 

Expert Comment

by:Jon8RFC
ID: 14675930
Thank you very much, heskyttberg!
I've had a very rough time for the past hour, and your solution did the trick.


However, I still have a question concerning my log format.  Here is my directive:
CustomLog "|C:/logs/rotatelogs.exe C:/logs/access/access_%Y-%m-%d--%H-%M-%S.log 86400 -360" combined

The only things that fails to work are the %H %M %S variables.  My log file is saved as "access_2005-08-15--00-00-00.log", and I don't understand why or how to fix the double zeros.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

730 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