Backup-LXCAEventLog

This cmdlet retrieves the event log in CSV format and appends the log to a local file. You can use this cmdlet to back up the event log periodically to avoid event log loss.

Note: You cannot pipe objects to this cmdlet.

Syntax

Get-LXCAEvent [-Connection LXCAConnection] 
               -Type String
               -StartSequenceNumber Long
               -Count Int
               -FileName String
              [-NoHead]
              [CommonParameter]

Parameters

-Connection LXCAConnection
Specifies the connection to the Lenovo XClarity Administrator server. If no connection is specified, the result from the last Connect-LXCA cmdlet is used.
-Type String
Specifies the event type. You can specify one of the following event types:
  • All
  • AuditLog
  • EventLog
-StartSequenceNumber Long
Specifies the starting event sequence number.
-Count Int
Specifies the number of events to be returned from the starting sequence number.
-FileName String
Specifies the file name to which the events are to be appended.
-NoHead
If specified, the CSV header is not saved to the local file.
CommonParameters
This cmdlet supports the following common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer, -PipelineVariable, -OutVariable. For detailed information about each common parameter, see the Microsoft PowerShell Common Parameters webpage.

Results

This cmdlet returns a BackupEventResult object.

Note: The BackupEventResult object has a property called NextSequenceNumber that indicates the starting sequence number that can be used for the next backup.

Examples

The following example backs up the event log to a local file every hour.

$cred = Get-Credential
Connect-LXCA -Host 192.0.2.0 -Credential $cred

$backupResult = Backup-LXCAEventLog -Type All -StartSequenceNumber 0 -Count 1000 -FileName c:\LXCALog.csv
While($true)
{
    Start-Sleep -Seconds (60*60*1)
    $backupResult = Backup-LXCAEventLog -Type All -StartSequenceNumber $backupResult.NextSequenceNumber` 
                                        -Count 1000 -FileName c:\LXCALog.csv -NoHead
}

Disconnect-LXCA