I'm trying to export the crawler log as shown in the CrawlLogURLExplorer
-section in the Search Service Application - Diagnostics - Crawl Log
from our productions system for our developers to use for trouble shooting.
But I'm not quite getting there.
First I though that the ULS-logs would contain the same information. But using Get-SPLogEvent
I soon discovered that wasn't the case.
And using Get-PnPSearchCrawlLog
from SharePointPnPPowerShell2019
only seems to work with SharePoint Online.
Then I tried this from the SharePoint Diary - Export SharePoint Search Crawl History to CSV using PowerShell
#Configuration Parameters $ContentSourceName = "Local SharePoint sites" $ResultsCount = 10 #Get Search Service application and Content Source $SearchServiceApplication = Get-SPEnterpriseSearchServiceApplication $ContentSource = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchServiceApplication | ? { $_.Name -eq $contentSourceName } #Get Crawl History $CrawlLog = new-object Microsoft.Office.Server.Search.Administration.CrawlLog($searchServiceApplication) $CrawlHistory = $CrawlLog.GetCrawlHistory($ResultsCount, $ContentSource.Id) #Export the Crawl History to CSV $CrawlHistory | Export-CSV "C:\CrawlHistory.csv" -NoTypeInformation
This got some result, but I am missing the related content URL.
I also tried looking for just Errors using
$SearchServiceApplication = Get-SPEnterpriseSearchServiceApplication $ContentSource = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $SearchServiceApplication | where Name -eq 'Local SharePoint sites' $CrawlLog = New-Object Microsoft.Office.Server.Search.Administration.CrawlLog($SearchServiceApplication) $ResultsCount = 10 $CrawlErrors = $CrawlLog.GetCrawlError($ResultsCount, $ContentSource.Id) $CrawlErrors
But still missing relevant information about what document is actually affected.