< Back

Get-GcLogEntry

Mon Jan 13, 2020 11:16 pm

NAME Get-GcLogEntry



SYNOPSIS

Gets log entries.





SYNTAX

Get-GcLogEntry [-Project <string>] [-LogName <string>] [-Severity {Default | Debug | Info | Notice | Warning |

Error | Critical | Alert | Emergency}] [-Before <DateTime>] [-After <DateTime>] [-Filter <string>]

[<CommonParameters>]





DESCRIPTION

Gets all log entries from a project or gets the entries from a specific log. Log entries can be filtered using

-LogName, -Severity, -After or -Before parameter. For advanced filtering, please use -Filter parameter.





PARAMETERS

-Project <string>

The project to check for log entries. If not set via PowerShell parameter processing, will default to the

Cloud SDK's DefaultProject property.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-LogName <string>

If specified, the cmdlet will filter out log entries that are in the log LogName.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Severity <LogSeverity>

If specified, the cmdlet will filter out log entries with the specified severity.



Possible values: Default, Debug, Info, Notice, Warning, Error, Critical, Alert, Emergency



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Before <DateTime>

If specified, the cmdlet will filter out log entries that occur before this datetime.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-After <DateTime>

If specified, the cmdlet will filter out log entries that occur after this datetime.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Filter <string>

If specified, the cmdlet will filter out log entries that satisfy the filter.



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



OUTPUTS

Google.Apis.Logging.v2.Data.LogEntry





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



PS C:\\> Get-GcLogEntry



This command gets all the log entries for the default project.

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



PS C:\\> Get-GcLogEntry -Project "my-project"



This command gets all the log entries from the project "my-project".

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



PS C:\\> Get-GcLogEntry -LogName "my-log"



This command gets all the log entries from the log named "my-backendservice".

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



PS C:\\> Get-GcLogEntry -LogName "my-log"



This command gets all the log entries from the log named "my-backendservice".

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



PS C:\\> Get-GcLogEntry -LogName "my-log" -Severity Error



This command gets all the log entries with severity ERROR from the log named "my-backendservice".

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



PS C:\\> Get-GcLogEntry -LogName "my-log" -Before [DateTime]::Now.AddMinutes(30)



This command gets all the log entries from the log named "my-backendservice" created before 30 minutes ago.

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



PS C:\\> Get-GcLogEntry -LogName "my-log" -After [DateTime]::Now.AddMinutes(30)



This command gets all the log entries from the log named "my-backendservice" created after 30 minutes ago.

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



PS C:\\> Get-GcLogEntry -Filter 'resource.type="gce_instance" AND severity >= ERROR'



This command gets all the log entries that satisfy filter.



RELATED LINKS

[Log Entries and Logs] (https://cloud.google.com/logging/docs/view/logs_index)

[Logs Filters] (https://cloud.google.com/logging/docs/v ... ed_filters)