Table of Contents

Get-PnPSearchCrawlLog

SYNOPSIS

Returns entries from the SharePoint search crawl log. Make sure you are granted access to the crawl log via the SharePoint search admin center at https://-admin.sharepoint.com/_layouts/15/searchadmin/crawllogreadpermission.aspx in order to run this cmdlet.

SYNTAX

Get-PnPSearchCrawlLog [-LogLevel <LogLevel>] [-RowLimit <Int32>] [-Filter <String>]
 [-ContentSource <ContentSource>] [-StartDate <DateTime>] [-EndDate <DateTime>] [-RawFormat] [-IncreaseRequestTimeout]
 [-Connection <PnPConnection>] 

DESCRIPTION

Allows to retrieve entries from the SharePoint search crawl log. To be able to use this command you need to grant access to the crawl log via the SharePoint search admin center at https://-admin.sharepoint.com/_layouts/15/searchadmin/crawllogreadpermission.aspx.

EXAMPLES

EXAMPLE 1

Get-PnPSearchCrawlLog

Returns the last 100 crawl log entries for site content.

EXAMPLE 2

Get-PnPSearchCrawlLog -Filter "https://contoso-my.sharepoint.com/personal"

Returns the last 100 crawl log entries for OneDrive content.

EXAMPLE 3

Get-PnPSearchCrawlLog -ContentSource UserProfiles

Returns the last 100 crawl log entries for user profiles.

EXAMPLE 4

Get-PnPSearchCrawlLog -ContentSource UserProfiles -Filter "mikael"

Returns the last 100 crawl log entries for user profiles with the term "mikael" in the user principal name.

EXAMPLE 5

Get-PnPSearchCrawlLog -ContentSource Sites -LogLevel Error -RowLimit 10

Returns the last 10 crawl log entries with a state of Error for site content.

EXAMPLE 6

Get-PnPSearchCrawlLog -EndDate (Get-Date).AddDays(-100)

Returns the last 100 crawl log entries up until 100 days ago.

EXAMPLE 7

Get-PnPSearchCrawlLog -RowLimit 3 -RawFormat

Returns the last 3 crawl log entries showing the raw crawl log data.

EXAMPLE 8

$ClientID= "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$env:SharePointPnPHttpTimeout = -1 #👈
Connect-PnPOnline -Url https://<tenant>-admin.sharepoint.com/ -Interactive -ClientId $ClientID -ErrorAction Stop # 👈

Get-PnPSearchCrawlLog -Filter "https://contoso-my.sharepoint.com/sites/Intranet" -IncreaseRequestTimeout

Increases the request timeout allowing the call to last up to 3 minutes. The ClientRuntimeContext enforces a three-minute limit; when increasing the timeout to its maximum of three minutes, this threshold may still be exceeded.

PARAMETERS

-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type: PnPConnection
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ContentSource

Content to retrieve (Sites, User Profiles). Defaults to Sites.

Type: ContentSource
Parameter Sets: (All)
Accepted values: Sites, UserProfiles

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-EndDate

End date to stop getting entries from. Default to current time.

Type: DateTime
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Filter

Filter to limit what is being returned. Has to be a URL prefix for SharePoint content, and part of a user principal name for user profiles. Wildcard characters are not supported.

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-IncreaseRequestTimeout

Extend the request timeout to permit command execution for up to 3 minutes.

Type: Switch
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LogLevel

Filter what log entries to return (All, Success, Warning, Error). Defaults to All

Type: LogLevel
Parameter Sets: (All)
Accepted values: Success, Warning, Error, All

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RawFormat

Show raw crawl log data

Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RowLimit

Number of entries to return. Defaults to 100.

Type: Int32
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-StartDate

Start date to start getting entries from. Defaults to start of time.

Type: DateTime
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Microsoft 365 Patterns and Practices