Uncategorized

Reports execution history

Run this script against ReportServer database to obtain basic historical overview of reports execution. Remember that default log history retention is 60 days.

SELECT
	[EL].[LogEntryId],
	[EL].[InstanceName],
	[C].[Path],
	[C].[Name] [ReportName],
	[EL].[UserName],
	CASE([EL].[ReportAction])
		WHEN 1 THEN 'Render'
		WHEN 2 THEN 'BookmarkNavigation'
		WHEN 3 THEN 'DocumentMapNavigation'
		WHEN 4 THEN 'DrillThrough'
		WHEN 5 THEN 'FindString'
		WHEN 6 THEN 'GetDocumentMap'
		WHEN 7 THEN 'Toggle'
		WHEN 8 THEN 'Sort'
		WHEN 9 THEN 'Execute'
		ELSE 'Unknown'
	END [ItemAction],
	[EL].[TimeStart], YEAR([EL].[TimeStart]) [Start_Year], MONTH([EL].[TimeStart]) [Start_Month],
	DATENAME(MONTH,[EL].[TimeStart]) [Start_Month_Name], DATENAME(DW,[EL].[TimeStart]) [Start_Day_Of_Week], 
	DATEPART(WEEKDAY,[EL].[TimeStart]) [Start_Day_Number_of_Week],
	[EL].[TimeEnd], [EL].[TimeDataRetrieval], [EL].[TimeProcessing], [EL].[TimeRendering],
	CASE([EL].[Source])		
		WHEN 1 THEN 'Live'
		WHEN 2 THEN 'Cache'
		WHEN 3 THEN 'Snapshot' 
		WHEN 4 THEN 'History' 
		WHEN 5 THEN 'AdHoc'
		WHEN 6 THEN 'Session'
		WHEN 7 THEN 'Rdce'
		ELSE 'Unknown'
	END [Source],
	[EL].[Status],
	[EL].[ByteCount],[EL].[RowCount],
	[EL].[Parameters], [C].[Description],
	[CBY].[UserName] [CreatedBy], [C].[CreationDate],
	[MBY].[UserName] [ModifiedBy], [C].[ModifiedDate]
FROM [dbo].[ExecutionLogStorage] [EL]
	LEFT JOIN [dbo].[Catalog] [C] ON [EL].[ReportID] = [C].[ItemID]
	LEFT JOIN [dbo].[Users] [CBY] ON [C].[CreatedByID] = [CBY].[UserID]
	LEFT JOIN [dbo].[Users] [MBY] ON [C].[ModifiedByID] = [MBY].[UserID]
WHERE [EL].[Source] = 1 AND [C].[Type] = 2
ORDER BY c.[Path], c.[Name]
GO