This SP expects a parameter @TimeInMin which has a default value of 15 Minutes.
Create Proc ReportLoginFailure (@TimeinMin int =15)
As
/*
Author :Sandesh Segu
Purpose :To report the failed loing attempts if any in given
range of time.
Version :1.0
More Scripts :http://sanssql.blogspot.com
*/
Declare @Count int
Create Table #ErrorLog
(ErrorLoggedDate DateTime,
ProcessInfo nvarchar(50),
ErrorText nvarchar(1000))
Insert into #ErrorLog exec sp_readerrorlog
Select @Count=Count(*) from #ErrorLog where ErrorText like 'Login failed for user%'
and datediff(Minute,ErrorLoggedDate,getdate())<=@TimeinMin
If @Count>0
Begin
Select Report=Cast(@Count As Varchar)+' Login Failures Reported in past '+Cast (@TimeinMin As varchar)+' Minutes.'
Select * from #ErrorLog where ErrorText like 'Login failed for user%'
and datediff(Minute,ErrorLoggedDate,getdate())<=@TimeinMin
End
Else
Select Report='No Login Failures Reported in the Specified Time Frame.'
Drop table #ErrorLog
GO
/*
Usage: Specify the time limit parameter in minutes for the SP. Default is 15 mins.
Exec ReportLoginFailure 600
*/
When there are no failures reported then the output will be:
When there are failures reported then the output will be:
2 comments:
Mua vé máy bay tại Aivivu, tham khảo
Vé máy bay đi Mỹ
chuyến bay đưa công dân về nước
vé máy bay từ Toronto về việt nam
mua vé máy bay từ nhật bản về việt nam
giá vé máy bay hàn quốc về việt nam
Vé máy bay từ Đài Loan về VN
khách sạn cách ly hồ chí minh
chi phi ve may bay cho chuyen gia nuoc ngoai
I know how to write a better essay and luckily I don't listen to others about it because now I know that I can sleep peacefully and that's because there is a write my essay for me cheap service where they write any essay.
Post a Comment