[MS4W-Users] MS4W Apache Logs
Christopher Hughes
chughes at co.lincoln.or.us
Fri Jan 22 17:28:25 UTC 2021
Thanks for the feedback! It's very helpful to know what other people are
doing.
It also looks like there's a relatively new option that allows you to
automatically overwrite old logs.
For example, this would create daily logs for 2 weeks before it starts
overwriting the old ones.
CustomLog "|bin/rotatelogs.exe -l -n 14 /ms4w/Apache/logs/access_log.log
86400" combined
On Fri, Jan 22, 2021 at 6:19 AM iGIS via MS4W-Users <
ms4w-users at lists.ms4w.com> wrote:
> Hi Chris,
>
> That's one of the things we changed as well and set our logs to a max
> size. Changing to this in httpd.conf seems to work well and creates ~50 MB
> files. We also changed the log format because we have a few sites in the
> apps folder, and the size constraint has the added benefit of being able to
> scan the directory and quickly see where it's less than 50 MB as that's
> usually the last time we restarted Apache!
>
> - ErrorLog "|C:/ms4w/Apache/bin/rotatelogs.exe -l
> C:/ms4w/Apache/logs/error_log_%Y%m%d_%H%M%S.log 50M"
> - LogFormat "%h %v %t \"%r\" %>s %b" comonvhost
> - CustomLog "|C:/ms4w/Apache/bin/rotatelogs.exe -l
> C:/ms4w/Apache/logs/access_log_%Y-%m-%d-%H_%M_%S.log 50M" comonvhost
>
> As for auto-removal, we just archive them off once a month or when we do
> something like upgrade MS4W, etc. We've gotten a lot of files in there but
> it's never been a problem other than possible disk space! But we do back
> up databases and auto-prune/delete those with a Windows batch (.bat) file.
> That looks like this but I switched it to the logs directory, and deletes
> everything over 15 days old b/c of the -15:
>
> FORFILES /p C:\ms4w\Apache\logs /s /m *.* /d -15 /c "cmd /c del @path"
> FOR /f "delims=" %%d in ('dir C:\ms4w\Apache\logs /s /b /ad ^| sort /r')
> do rd "%%d"
>
> We save that text as autoprune.bat or similar and just run that in Task
> Scheduler once a week. That makes our backups fluctuate between 2-3 weeks.
> If you run it daily it'd always be at the 15 days.
>
> Hope that helps and makes sense,
> Andrew
>
>
>
>
> On 1/21/2021 7:24 PM, Christopher Hughes via MS4W-Users wrote:
>
> I'm curious if anyone has felt the need to modify the defaults for Apache
> logs (and if so, how they went about doing it). I'm specifically referring
> to how
> logs are archived and deleted.
>
> We're transitioning from a Ubuntu server to a Windows server. By default
> our Ubuntu server rotates and deletes old logs so that the log directory
> doesn't get too large. On Windows that isn't the case. I'm concerned
> about potential server crashes if the log directory isn't cleaned out every
> once in a while.
>
> It looks like the logrotate tool that ships with ms4w would accomplish the
> same
> goal (combined with scheduling old logs to be automatically deleted), but
> I
> wanted to hear the opinions of people who are more experienced with
> Windows servers and how they address this issue.
>
> I appreciate any feedback,
>
> Chris
>
> --
> Chris Hughes
>
> GIS Analyst
> Lincoln County Surveyor Department
> 880 NE 7th St. l Newport, OR 97365
> Tel: (541) 574 1283
>
> _______________________________________________
> MS4W-Users mailing listMS4W-Users at lists.ms4w.comhttps://lists.ms4w.com/mailman/listinfo/ms4w-users
>
>
> _______________________________________________
> MS4W-Users mailing list
> MS4W-Users at lists.ms4w.com
> https://lists.ms4w.com/mailman/listinfo/ms4w-users
>
--
Chris Hughes
GIS Analyst
Lincoln County Surveyor Department
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ms4w.com/pipermail/ms4w-users/attachments/20210122/01b19f4d/attachment.htm>
More information about the MS4W-Users
mailing list