< Back

Get-ObjectLog

Sun Jan 19, 2020 5:41 pm

NAME Get-ObjectLog



SYNOPSIS

Retrieves object logs from a PRTG Server.





SYNTAX

Get-ObjectLog [[-Name] <string[]>] [[-Filter] <SearchFilter[]>] [-Count <int>] [-EndDate <DateTime>] [-Object

<PrtgObject>] [-StartDate <DateTime>] [-Status {SystemStart | SystemStop | ProbeGidDenied | WebServer |

UpdateAvailable | GraphCache | Data | SystemInfo | ProbeDenied | NotificationItem | ProbeKeyDenied | NotifyChanged

| Info | WMIFallback | UsePerfCounters | FtpMode | Created | Deleted | Moved | Edited | NewChildObject |

ChildObjectDeleted | ChildObjectMoved | MovedObjectInserted | SubnodeCreated | SubnodeDeleted | SubnodeEdited |

CreatedFromClone | Activation | Unknown | Resuming | Pausing | PausedByUser | PausedByDependency |

PausedBySchedule | Up | Down | Warning | Unusual | Connected | Disconnected | ProbeInfo | PausedByLicense | Active

| DownAcknowledged | DownPartial | ProbeApproved | UpdateCheck | SystemError | ReportDone | NewProbe |

SmtpConfiguration | NewClusterNode | UpdateApplied | OverloadProtection | Reminder | GroupDiscoveryStarted |

GroupDiscoveryFinished | DiscoveryDeviceFound | DiscoveryTemplateApplied | DiscoveryFailed | ClusterStart |

ClusterStop | ClusterInit | ClusterConnection | ClusterNodeConnected | ClusterNodeDisconnected |

ClusterMasterChanged | ClusterInfo | MultipleClusterMasters}] [<CommonParameters>]



Get-ObjectLog [[-Name] <string[]>] [[-Filter] <SearchFilter[]>] [-Count <int>] [-Object <PrtgObject>] [-Period

{Today | Yesterday | LastWeek | LastMonth | LastSixMonths | LastYear | All}] [-Status {SystemStart | SystemStop |

ProbeGidDenied | WebServer | UpdateAvailable | GraphCache | Data | SystemInfo | ProbeDenied | NotificationItem |

ProbeKeyDenied | NotifyChanged | Info | WMIFallback | UsePerfCounters | FtpMode | Created | Deleted | Moved |

Edited | NewChildObject | ChildObjectDeleted | ChildObjectMoved | MovedObjectInserted | SubnodeCreated |

SubnodeDeleted | SubnodeEdited | CreatedFromClone | Activation | Unknown | Resuming | Pausing | PausedByUser |

PausedByDependency | PausedBySchedule | Up | Down | Warning | Unusual | Connected | Disconnected | ProbeInfo |

PausedByLicense | Active | DownAcknowledged | DownPartial | ProbeApproved | UpdateCheck | SystemError | ReportDone

| NewProbe | SmtpConfiguration | NewClusterNode | UpdateApplied | OverloadProtection | Reminder |

GroupDiscoveryStarted | GroupDiscoveryFinished | DiscoveryDeviceFound | DiscoveryTemplateApplied | DiscoveryFailed

| ClusterStart | ClusterStop | ClusterInit | ClusterConnection | ClusterNodeConnected | ClusterNodeDisconnected |

ClusterMasterChanged | ClusterInfo | MultipleClusterMasters}] [<CommonParameters>]



Get-ObjectLog [[-Name] <string[]>] [[-Filter] <SearchFilter[]>] [-Count <int>] [-EndDate <DateTime>] [-Id <int>]

[-Interval <int>] [-StartDate <DateTime>] [-Status {SystemStart | SystemStop | ProbeGidDenied | WebServer |

UpdateAvailable | GraphCache | Data | SystemInfo | ProbeDenied | NotificationItem | ProbeKeyDenied | NotifyChanged

| Info | WMIFallback | UsePerfCounters | FtpMode | Created | Deleted | Moved | Edited | NewChildObject |

ChildObjectDeleted | ChildObjectMoved | MovedObjectInserted | SubnodeCreated | SubnodeDeleted | SubnodeEdited |

CreatedFromClone | Activation | Unknown | Resuming | Pausing | PausedByUser | PausedByDependency |

PausedBySchedule | Up | Down | Warning | Unusual | Connected | Disconnected | ProbeInfo | PausedByLicense | Active

| DownAcknowledged | DownPartial | ProbeApproved | UpdateCheck | SystemError | ReportDone | NewProbe |

SmtpConfiguration | NewClusterNode | UpdateApplied | OverloadProtection | Reminder | GroupDiscoveryStarted |

GroupDiscoveryFinished | DiscoveryDeviceFound | DiscoveryTemplateApplied | DiscoveryFailed | ClusterStart |

ClusterStop | ClusterInit | ClusterConnection | ClusterNodeConnected | ClusterNodeDisconnected |

ClusterMasterChanged | ClusterInfo | MultipleClusterMasters}] [-Wait <SwitchParameter>] [<CommonParameters>]





DESCRIPTION

The Get-ObjectLog cmdlet retrieves event logs from a PRTG Server. If no object is specified, Get-ObjectLog will

retrieve results from the Root PRTG Group (ID: 0). Logs are ordered from newest to oldest. When retrieving logs

from an object, all logs on child objects are also included. By default, PRTG only stores 30 days worth of logs.



If no date range or count is specified, by default Get-ObjectLog will retrieve all logs defined on the specified

object for the last 7 days unless the specified object is the root group (ID: 0) or a probe, in which cause only

logs that have occurred today will be retrieved.



When specifying a date range, well known constants as well as manual start and end times can be specified. When

specifying a date and time, the meaning of -StartDate and -EndDate are dependent upon the order with which the

logs are being output. When logs are ordered from newest to oldest -StartDate refers to the time closest to now,

while -EndDate represents the time furthest away from now. When logs are ordered from oldest to newest (i.e. when

-Wait is specified) -StartDate represents the point in time logs furthest away from now logs should be retrieved

from going into the future.



Logs can be streamed continuously from a PRTG Object by specifying the -Wait parameter. When -Wait is specified

(also aliased as -Tail) PrtgAPI will continuously poll PRTG for new logs according to a specified -Interval,

outputting them to the console as they arrive in order from oldest to newest. If no -Interval is specified, by

default Get-ObjectLog will poll once per second. A -StartDate can optionally be specified, specifying the initial

point in time PrtgAPI should retrieve logs from. When -Wait is specified -EndDate will have no effect. Specifying

an -EndDate in conjunction with -Wait will cause a warning to be emitted to the warning stream specifying that the

-EndDate parameter will be ignored.



Logs can be filtered to those of one or more event types by specifying the -Status parameter. Logs can also be

filtered according to their event name, however note that name based filtering of Get-ObjectLog is performed

client side, not server side. As such, specifying a -Name in conjunction with -Count will not work. This can be

cirvumvented using Select-Object with the -First parameter instead.



Note that while Get-ObjectLog considers the "start time" as being the point in time closest to now and the "end

time" as the point in time furthest away from now when logs are ordered from newest to oldest, PRTG's underlying

API actually defines these in the opposite way. Since logs are ordered from newest to oldest however, PrtgAPI

flips these definitions as to prevent any confusion. Keep this in mind in the event the -Verbose parameter is

specified, as the start and end times will appear to be switched. When -Wait is specified the meaning of

-StartDate and -EndDate are flipped to match their meaningings in the underlying API so that logs can continuously

be retrieved.





PARAMETERS

-Object <PrtgObject>

Object to retrieve logs for. If no object is specified, defaults to the root object (group ID: 0)



Required? false

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Id <int>

ID of the object to retrieve logs for.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-StartDate <DateTime>

Start time to retrieve logs from. If no value is specified, defaults to the current date and time.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-EndDate <DateTime>

End time to retrieve logs until. If no value is specified, defaults to 7 prior from the StartDate.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Period <RecordAge>

Time period to retrieve logs from. If no value is specified, retrieves logs from 7 days ago to the current

date and time.



Possible values: Today, Yesterday, LastWeek, LastMonth, LastSixMonths, LastYear, All



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Status <LogStatus[]>

Only retrieve objects that match a specific status.



Possible values: SystemStart, SystemStop, ProbeGidDenied, WebServer, UpdateAvailable, GraphCache, Data,

SystemInfo, ProbeDenied, NotificationItem, ProbeKeyDenied, NotifyChanged, Info, WMIFallback, UsePerfCounters,

FtpMode, Created, Deleted, Moved, Edited, NewChildObject, ChildObjectDeleted, ChildObjectMoved,

MovedObjectInserted, SubnodeCreated, SubnodeDeleted, SubnodeEdited, CreatedFromClone, Activation, Unknown,

Resuming, Pausing, PausedByUser, PausedByDependency, PausedBySchedule, Up, Down, Warning, Unusual, Connected,

Disconnected, ProbeInfo, PausedByLicense, Active, DownAcknowledged, DownPartial, ProbeApproved, UpdateCheck,

SystemError, ReportDone, NewProbe, SmtpConfiguration, NewClusterNode, UpdateApplied, OverloadProtection,

Reminder, GroupDiscoveryStarted, GroupDiscoveryFinished, DiscoveryDeviceFound, DiscoveryTemplateApplied,

DiscoveryFailed, ClusterStart, ClusterStop, ClusterInit, ClusterConnection, ClusterNodeConnected,

ClusterNodeDisconnected, ClusterMasterChanged, ClusterInfo, MultipleClusterMasters



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Wait <SwitchParameter>

Indicates Get-ObjectLog should continuously retrieve new records from PRTG according to a specified polling

-Interval.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Tail <SwitchParameter>

Indicates Get-ObjectLog should continuously retrieve new records from PRTG according to a specified polling

-Interval.



This is an alias of the Wait parameter.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Interval <int>

Interval with which Get-ObjectLog should poll for new records when using -Wait.



Required? false

Position? named

Default value 1

Accept pipeline input? false

Accept wildcard characters? false



-Name <string[]>

Filter the response to objects with a certain name. Can include wildcards.



Required? false

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Filter <SearchFilter[]>

Filter the response to objects that match one or more criteria.



Required? false

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Count <int>

Maximum number of results to return. Note: when this parameter is specified wildcard filters such as Name may

behave unexpectedly when wildcard characters are not used and records are being filtered by an additional

property other than ParentId.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

PrtgAPI.PrtgObject

Object to retrieve logs for. If no object is specified, defaults to the root object (group ID: 0)



PrtgAPI.SearchFilter[]

Filter the response to objects that match one or more criteria.





OUTPUTS

PrtgAPI.Log





---------- EXAMPLE 1 ----------



C:\\> Get-ObjectLog



Retrieve all logs from the root group (ID: 0) from today.



---------- EXAMPLE 2 ----------



C:\\> Get-ObjectLog -Count 4000



Retrieve the last 4000 logs from the root group.



---------- EXAMPLE 3 ----------



C:\\> Get-Device dc-1 | Get-ObjectLog



Retrieve all logs on device "dc-1" for the last week.



---------- EXAMPLE 4 ----------



C:\\> Get-ObjectLog -Start (Get-Date).AddDays(-3)



Retrieve all logs from the root node from 3 and 4 days ago.



---------- EXAMPLE 5 ----------



C:\\> Get-Sensor -Id 2460 | Get-ObjectLog -EndDate (Get-Date).AddDays(-4)



Retrieve all logs from the sensor with ID 2460 between now and 4 days ago.



---------- EXAMPLE 6 ----------



C:\\> Get-Probe *contoso* | Get-ObjectLog -Since LastWeek



Retrieve all logs from all probes whose name contains "contoso" between now and last week.



---------- EXAMPLE 7 ----------



C:\\> Get-ObjectLog -Status Disconnected -Count 3



Retrieve the last 3 times a probe disconnected.



---------- EXAMPLE 8 ----------



C:\\> Get-Device exch-1 | Get-ObjectLog ping | select -First 4



Retrieve the last 4 events that occurred to the sensor named "ping" on the device named "exch-1".



---------- EXAMPLE 9 ----------



C:\\> Get-ObjectLog -Id 1001 -EndDate $null



Retrieve all logs from the object with ID 1001.



---------- EXAMPLE 10 ----------



C:\\> Get-ObjectLog -Status Connected -Wait



Continuously poll PRTG for new Probe Connected events, requesting once every second.



RELATED LINKS

Online version: https://github.com/lordmilko/PrtgAPI/wi ... ion#logs-1

Get-Sensor

Get-Device

Get-Group

Get-Probe