﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Dinesh Priyankara / Article Discussions / Article Discussions by Author  / SQL Server Auditing - Part 1 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 12:13:52 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>Very cool, I definitely need to implement this.  I have two servers that go through a ridiculous amount of logins every day, so this will be good to help monitor them more effectively.I've also taken to forcing the error log to cycle every two weeks, syncing with our pay period.  At 11:59pm Sunday night, I have a scheduled job that runs a sp_cycle_errorlog to keep the logs a bit more tidy.Thanks!</description><pubDate>Fri, 01 Jun 2007 11:02:00 GMT</pubDate><dc:creator>Wayne West</dc:creator></item><item><title>RE: SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>Hi. This is my first post to this forum, so please excuse me if I'm doing wrong.And excuse my poor english, I am german.First of all great thanks for your article. Been great help... and sounding a good idea, so I added some more code and I'd ike to share the results with you.1st: I used exactly the code provided in the article for creating the base table, only renaming the table from #errorlog to sk_errorlog according to our programming rules.2nd: I built a second table as follows:------------tbl-----------------CREATE TABLE [sk_errorlog2] (	[rowID] [int] IDENTITY (1, 1) NOT NULL ,	[datum] [varchar] (10) COLLATE Latin1_General_CI_AS NULL ,	-- datum is german for date	[textRow] [varchar] (4000) COLLATE Latin1_General_CI_AS NULL ,	[uhrzeit] [varchar] (10) COLLATE Latin1_General_CI_AS NULL ,	-- uhrzeit is german for time	[kategorie] [varchar] (100) COLLATE Latin1_General_CI_AS NULL  -- same for category) ON [PRIMARY]GO--------------------------------I will add colums like "servername" or similar later on when using it for multiple servers.This table is meant to be a permanent depository for all sql-logs in my environment (only 5 sql-servers here)3rd: I created some sp's for updating the second tablehere is the first for inserting new rows:----------------------SP1-----------------------CREATE  PROCEDURE [dbo].[sp_sk_errorlog] ASinsert into sk_errorlog2 (textrow)  (select     RTRIM(a.textrow) + COALESCE (b.textrow,'') as textrowFROM     	(          SELECT                *           FROM                sk_errorlog           WHERE                continuationrow=0	) as  A LEFT OUTER JOIN      	(	 SELECT               *          FROM               sk_errorlog          WHERE               continuationrow=1	) as B ON 	A.rowID = B.rowID - 1 where  ( RTRIM(a.textrow) + COALESCE (b.textrow,'')	not in  (select textrow from sk_errorlog2)	and 	a.continuationrow=0	))GO-------------------------------------------------------the second sp will separate some values from the textrow:-----------------sp2-------------------------CREATE  PROCEDURE [dbo].[sp_sk_errorlog_update] AS-----Check your collation/datetime settings here!-----update sk_errorlog2 set datum =(select (case  when (left (textrow,2) = '20') then left (textrow,10)else null end)),uhrzeit =(case  ( right (left (textrow,12),1) )	when '0' then right ((left (textrow,19)),8)	when '1' then right ((left (textrow,19)),8)	when '2' then right ((left (textrow,19)),8)	else null	end) ,kategorie =(case	----check for language settings here, e.g.: fehler is german for error!	----Here you can put the messages into categories, I started with the following	when textrow  like '%[F,f]ehler%' or textrow  like '[F,f]ehler%' then 'error'	when textrow  like '%backup%' and textrow  like '%datenbankprotokoll%' then 'protokoll'	when textrow  like '%backup%' then 'backup'	when textrow  like '%server%' then 'server'	when textrow  like '%logon%' then 'logon'	else 'sonstiges'	end)where datum is null----------------------------------------/*NOTE: the following 3 MS standard entries are the only ones without datetime information ( at least here :-)May  3 2005 23:18:38Copyright (c) 1988-2003 Microsoft CorporationStandard Edition on Windows NT 5.2 (Build 3790: Service Pack 2) */So now you should have some information in a better queryable form than directly from xp_readerrorlog.Now use the gui you like best for creating some "management dashboard" where you can list the events separated by time and category. Looking foward to part 2 and Keep on coding!SK</description><pubDate>Fri, 01 Jun 2007 09:48:00 GMT</pubDate><dc:creator>Hans Birndaila</dc:creator></item><item><title>RE: SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Only a little humble suggestion: to read/write configuration settings into the Windows Registry, Enterprise Manager uses xp_instance_regread and xp_instance_regwrite, that are the same as xp_regread and xp_regwrite, except already focused on the actual instance...&lt;/P&gt;&lt;P&gt;For those who want to SQL for the current instance, they are easier to use.&lt;/P&gt;&lt;P&gt;Note: You can profile (SQL Profiler) the activity of E.M. &lt;img src='images/emotions/wink.gif' height='20' width='20' border='0' title='Wink' align='absmiddle'&gt;&lt;/P&gt;&lt;P&gt;Bye,&lt;/P&gt;&lt;P&gt;Daniele.&lt;/P&gt;</description><pubDate>Fri, 01 Jun 2007 02:09:00 GMT</pubDate><dc:creator>scout</dc:creator></item><item><title>RE: SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>&lt;P&gt;Very helpful information!&lt;/P&gt;</description><pubDate>Fri, 01 Jun 2007 00:43:00 GMT</pubDate><dc:creator>jacob sebastian</dc:creator></item><item><title>RE: SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>Thank you for this article.  Very timely since I am right now creating a document that includes sql server auditing.</description><pubDate>Wed, 30 Nov 2005 13:56:00 GMT</pubDate><dc:creator>Emelie Clarin</dc:creator></item><item><title>RE: SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>Thank you -- well written.</description><pubDate>Fri, 05 Aug 2005 16:12:00 GMT</pubDate><dc:creator>Mike Schmidt</dc:creator></item><item><title>RE: SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>Glad that snippet of code was helpful. &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;</description><pubDate>Thu, 05 Aug 2004 13:18:00 GMT</pubDate><dc:creator>K. Brian Kelley</dc:creator></item><item><title>RE: SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>&lt;P&gt;Not an hour before I read this article, I was staring at a script in query analyzer, trying to figure out how I was going to import the current SQL error log into my table.  The script has been staring back at me for a couple of days.   After reading this article, I'm back on track!  Thanks for a great article!&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description><pubDate>Thu, 05 Aug 2004 10:02:00 GMT</pubDate><dc:creator>hoo-t</dc:creator></item><item><title>RE: SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>Excellent article - well done.  I especially liked the screen prints with the red outline showing the important part of the display.  I'm looking forward to Part Two...</description><pubDate>Thu, 05 Aug 2004 08:43:00 GMT</pubDate><dc:creator>cppwiz</dc:creator></item><item><title>SQL Server Auditing - Part 1</title><link>http://www.sqlservercentral.com/Forums/Topic128097-108-1.aspx</link><description>Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/bkelley/sqlserverauditingpart1.asp</description><pubDate>Sun, 25 Jul 2004 22:04:00 GMT</pubDate><dc:creator>K. Brian Kelley</dc:creator></item></channel></rss>