How do I delete the log files that Elmah generates on the server?
Is there a setting within Elmah that I can use to delete log files? I would prefer to specify some cr
This SQL script deletes the rows older than the newest "size" rows:
declare @size INTEGER = 50;
declare @countno INTEGER;
SELECT @countno = count([ErrorId]) FROM [dbo].[ELMAH_Error]
/*
SELECT TOP (@countno-@size)
[ErrorId]
,[TimeUtc]
,[Sequence]
FROM [dbo].[ELMAH_Error]
order by [Sequence] asc
GO
*/
DELETE FROM [dbo].[ELMAH_Error]
WHERE [ErrorId] IN (
SELECT t.[ErrorId] FROM (
SELECT TOP (@countno-@size)
[ErrorId]
,[TimeUtc]
,[Sequence]
FROM [dbo].[ELMAH_Error]
order by [Sequence] asc
) t
)
GO
/*
-- Print remaining rows
SELECT * FROM [dbo].[ELMAH_Error]
order by [Sequence] desc
*/