Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Errorlog Expand / Collapse
Author
Message
Posted Tuesday, March 3, 2009 4:50 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, April 26, 2014 6:12 AM
Points: 88, Visits: 468
Hoi,

Does anyone know how to read the sp_readerrorlog and only show the logs of the current date or an other specific date?

kind regards,

bryan
Post #667174
Posted Tuesday, March 3, 2009 4:53 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 8:10 AM
Points: 40,176, Visits: 36,574
Insert the results of sp_errorlog into a table (temp table's fine) and then query that with a filter on the date.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #667178
Posted Tuesday, March 3, 2009 6:47 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, April 26, 2014 6:12 AM
Points: 88, Visits: 468
Hoi Gail ,

thanks for the response. ik did like you told and created a table where the content of the errorlog is in. now i am struggeling with a query to get only those lines with the logdate = current date. i have seen that you've got to do something with cast, but would appreciate for some help with this one.

thanks in advance

this is the simple table i created:

create table #errorlog
(logdate datetime,
processinfo nchar(30),
info nchar(2000))
Post #667254
Posted Tuesday, March 3, 2009 7:17 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 8:10 AM
Points: 40,176, Visits: 36,574
WHERE logdate >= dateadd(dd, datediff(dd,0, getdate()),0) AND logdate < dateadd(dd, datediff(dd,0, getdate())+1,0)

will get you today's records. Play with that and you should be able to get x days past easily



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #667273
Posted Tuesday, March 3, 2009 7:42 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, April 26, 2014 6:12 AM
Points: 88, Visits: 468
thanks a lot gail, you know working with oracle for the most time as a oracle dba and switching to sql server and back sometimes turns my mind up side down. but i am learning. thanks again.

bryan
Post #667288
Posted Wednesday, March 4, 2009 12:43 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, March 27, 2014 11:17 PM
Points: 309, Visits: 814
Hi,
Since you have posted this in SQL 2005, you can use tip in below url to directly search between dates using xp_readerrorlog. Incase you are writing this code to send DBA Team mail whenever error occurs then you can specify this query directly in DBMail.

http://www.sqlserverdba.co.cc/2009/03/spreaderrorlog-sql-2005-search-for.html


Regards,
Sakthi
My Blog -> http://www.sqlserverdba.co.cc
Post #667887
Posted Wednesday, March 4, 2009 1:08 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 23, 2009 10:37 AM
Points: 5, Visits: 63
I have an article on SQLteam that may help you out. http://www.sqlteam.com/article/using-xp_readerrorlog-in-sql-server-2005
Post #668624
Posted Saturday, March 7, 2009 2:12 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, April 26, 2014 6:12 AM
Points: 88, Visits: 468
sorry for the late reply but thanks Sakthi this also helped me
Post #670983
Posted Saturday, March 7, 2009 2:13 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, April 26, 2014 6:12 AM
Points: 88, Visits: 468
thanks for you reply dan. but is there a parameter for showing only for example the logs from for example today?
Post #670984
Posted Sunday, March 8, 2009 4:23 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 23, 2009 10:37 AM
Points: 5, Visits: 63
Yes look at the botttom of the article in the comments. you can use a data range so you can restrict/read log for whatever date range you woulod like.
Post #671083
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse