administrar logs

13/01/2004 - 21:10 por Fernando | Informe spam
Hola Foro...
es la primera vez que escribo en este foro y no se si
antes se habrá preguntado.
hay alguna forma que, por linea de comandos, se pueda
hacer backup y luego limpieza de logs de los servidores de
un dominio?

muchas gracias.

Preguntas similare

Leer las respuestas

#1 Rafael Villaseñor Jofré
14/01/2004 - 13:14 | Informe spam
Hola...
Te paso 2 Scripts que resuelven tu problema...

1)
Backup and Clear an Event Log
Description
Backs up and clears the Application event log.
Script Code
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Backup)}!\\" & _
strComputer & "oot\cimv2")
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile where LogFileName='Application'")
For Each objLogfile in colLogFiles
errBackupLog = objLogFile.BackupEventLog("c:\scripts\application.evt")
If errBackupLog <> 0 Then
Wscript.Echo "The Application event log could not be backed up."
Else
objLogFile.ClearEventLog()
End If
Next

*****************************************************************
2)
Backup and Clear Large Event Logs
Description
Backs up and clears am event log if the log file size is larger than 20
megabytes.
Script Code
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate, (Backup, Security)}!\\" _
& strComputer & "oot\cimv2")
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile")
For each objLogfile in colLogFiles
If objLogFile.FileSize > 100000 Then
strBackupLog = objLogFile.BackupEventLog _
("c:\scripts\" & objLogFile.LogFileName & ".evt")
objLogFile.ClearEventLog()
End If
Next
*****************************************************************

Saludos y suerte

Rafael E. Villaseñor Jofré
IT Manager
ServerTech Argentina


"Fernando" escribió en el mensaje
news:047301c3da11$54d1ca40$
Hola Foro...
es la primera vez que escribo en este foro y no se si
antes se habrá preguntado.
hay alguna forma que, por linea de comandos, se pueda
hacer backup y luego limpieza de logs de los servidores de
un dominio?

muchas gracias.
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida