FAQ |
Kalender |
![]() |
#1 | ||
|
|||
Medlem
|
Nu börjar mina Apache-access loggfiler blir alldeles för stora för att hantera och jag blev förvånad över att Apache inte har inbyggd log rotation.
![]() Nu undrar jag lite hur ni har gjort för att lösa detta? Speciellt ni som kör Windows miljö som jag gör. |
||
![]() |
![]() |
![]() |
#2 | ||
|
|||
Medlem
|
Citat:
|
||
![]() |
![]() |
![]() |
#3 | ||
|
|||
Mycket flitig postare
|
I unixmiljö kan du tömma loggfilen med följade kommando.
Citat:
|
||
![]() |
![]() |
![]() |
#4 | |||
|
||||
Mycket flitig postare
|
Detta är den bästa modulen som jag hittat:
http://www.apachelounge.com/download...-1.00a-w32.zip (finns två olika, en för apache 2.0 och en för 2.2) Jag har konfigurerat så att det skapas en ny logfil för varje månad: domännamn-YY-MM.log Rotatelogs.exe som följer med Win32 Apache rekommenderar jag inte, den skapar massvis med processer som ligger och jävlas... |
|||
![]() |
![]() |
![]() |
#5 | ||
|
|||
Medlem
|
Citat:
![]() |
||
![]() |
![]() |
![]() |
#6 | |||
|
||||
Flitig postare
|
här är ett vbscript för att packa iis-loggfiler... borde vara enkelt att trixa till för dina ändamål... tar inget ansvar för funktionen :lol:
kräver winrar på maskinen... lycka till! EDIT: oj missade att du redan hade fått hjälp... aja.. kanske är bra med nåt alternativ ![]() Kod:
Option Explicit 'Installation '------------- 'Update the following settings to relect the setup of your webserver ' 'This value should be set to the name of your server. Keep this to the same format 'as the example value. Const serverName="7.0.0.1\" 'This value should be set to the root path to all of the domains on the webserver. 'Keep this to the same format as the example value. If you have more than one location 'of website folders you can have multiple copied of this script running for each location Const DomainPath="c$\Domains\" 'This value sets the number of days worth of logs that should be kept. Any log files, 'either compressed or uncompressed, will by removed if they are older than the number of 'days set. Const RemoveOlderThan=190 'This value sets the number of days worth of logs that should be kept unarchived. Any log files, 'uncompressed, will by compressed if they are older than the number of 'days set. Const ArchiveOlderTHan=2 'To complete this application installation type in the following command into the 'command prompt so that the application runs within a command prompt instead of producing 'hundreds of message boxes: ' cscript //h:cscript ' 'The final step is to add this script into the Windows scheduled tasks. It's best not to set 'this script to run too close to midnight as Helm may be collecting log information at this time. 'Generally the quietest hosting time is around 6-7am. '********************************************************************************** Dim fso, fDomDir, fLogDir, fLog, todayDate todayDate=cDate(day(now) &" "& MonthName(Month(Now),true) &" "& Year(Now)) Set fso = CreateObject("Scripting.FileSystemObject") If Not fso.FolderExists(serverName & DomainPath) Then RaiseError "Can Not Find Domain Folder" Else getDomainStats End If set fso=Nothing '================Functions============== Private Sub GetDomainStats() Dim WshShell, CABReturnCode, CABCommand Dim fileDate Set WshShell = WScript.CreateObject("WScript.Shell") For Each fDomDir in fso.GetFolder(serverName & DomainPath).SubFolders DebugOut("Checking Domain "& UCase(fDomDir.Name)) If fso.FolderExists(fDomDir.Path &"\Logs") Then For Each fLogDir in fso.GetFolder(fDomDir.Path &"\Logs").SubFolders For Each fLog in fLogDir.Files If UCase(Left(fLog.Name,2))="EX" And UCase(Right(fLog.Name,4))=".ZIP" Then fileDate=cDate(Mid(fLog.name,3,2) &" "& monthname(cint(Mid(fLog.name,5,2)),true) &" "& Mid(fLog.name,7,2)) If fileDate< DateAdd("d", toDayDate, -RemoveOlderThan) Then DebugOut("Deleting "& flog.name) fLog.Delete End If ElseIf UCase(Left(fLog.Name,2))="EX" And UCase(Right(fLog.Name,4))=".LOG" Then fileDate=cDate(Mid(fLog.name,3,2) &" "& monthname(cint(Mid(fLog.name,5,2)),true) &" "& Mid(fLog.name,7,2)) If fileDate< DateAdd("d", toDayDate, -RemoveOlderThan) Then DebugOut("Deleting "& flog.name) fLog.Delete Else '---CAB logfile---- if fileDate < DateAdd("d", toDayDate, -ArchiveOlderTHan) Then CABCommand = """C:\Program Files\WinRAR\rar.exe"" a " & Left(fLog.Path,Len(fLog.Path)-3) & "rar" & " " & fLog.Path wscript.echo cabcommand CABReturnCode = WshShell.Run(CABCommand, 7, True) If (Err.Number <> 0) Then RaiseError Err.Description & " (" & Err.Number & ")" ElseIf (CABReturnCode <> 0) Then RaiseError "Return code from WZZIP.EXE was " & CABReturnCode Else fLog.Delete End If End If End If '---Done--- End if Next Next Else RaiseError "Can Not Find The Log Folder" End If Next Set WshShell=Nothing End Sub Private Sub DebugOut(strDebugText) WScript.Echo strDebugText End Sub Private Sub RaiseError(strErrText) WScript.Echo "ERROR: "& strErrText End Sub |
|||
![]() |
![]() |
![]() |
#7 | ||
|
|||
Bara ett inlägg till!
|
usch, jag får nästan kräkningar när jag ser syntaxen
![]() |
||
![]() |
![]() |
![]() |
#8 | ||
|
|||
Medlem
|
Citat:
Alla (Windows) lösningar är intressanta för mig, tack! ![]() |
||
![]() |
![]() |
![]() |
#9 | |||
|
||||
Mycket flitig postare
|
Citat:
Jag får inte detta att funka. Servern vägrar starta pga detta, eller får meddelande av tjänstehanteraren att den startades och stängdes av igen. Men jag fattar inte vad jag ska göra med manifestfilen. Ska den bara ligga sådär? Eller ska den döpas om eller hanteras på något sätt? Jag fattade inte vad jag installerade visual studiogrejen/whatever för. ![]() Sen fattar jag inte var man ställer in inställningarna för modulen heller... Skapligt lost. Deras readme är lätt inte anpassad för nån som inte fattar ett skit om servrar. ![]() |
|||
![]() |
![]() |
![]() |
#10 | |||
|
||||
Mycket flitig postare
|
inget alls vad jag vet. Eller var slänger apache ut sina interna errors? I error.log finns iaf inget.
Men jag fattar fortfarande inte var man ställer in de där inställningarna. ![]() Jag har slängt in binäfilen och modulen i respektive mapp och aktiverat modulen conf-filen. Det är allt. ![]() |
|||
![]() |
![]() |
Svara |
|
|