How to audit server/DB access

  • I have a security concern:

    Whoever made any attempts to log onto my server/database, I need to record that info, no matter how the user access it, failed or succeeded, even through a valid account and via management studio.

    Can this be accomplished? my thought is it would be great if I can even track down the person's computer info like computer name, IP address, etc.

    Thanks. Any hint would be appreciated.

  • halifaxdal (2/18/2010)


    I have a security concern:

    Whoever made any attempts to log onto my server/database, I need to record that info, no matter how the user access it, failed or succeeded, even through a valid account and via management studio.

    Can this be accomplished? my thought is it would be great if I can even track down the person's computer info like computer name, IP address, etc.

    Thanks. Any hint would be appreciated.

    Yes, Go to Server Properties --> Under security -->Check Both Failed and Successful Login. By default only failed logins, Logs will fill up quickly, you will see client IP, i am sure about machine name, once you change the settings you may need to recycle SQL services to take effect.

    EnjoY!

    EnjoY!
  • Try this

    declare @tbl table ( logdate datetime, processinfo nvarchar(20), login_text nvarchar(max))

    insert into @tbl (logdate, processinfo, login_text)

    exec sp_readerrorlog

    select * , '[' + SUBSTRING( login_text , PATINDEX ( '%CLIENT:%', login_text)+7, len(login_text)) IP_Address from @tbl where login_text like '%login%'

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • Bhuvnesh (2/19/2010)


    Try this

    declare @tbl table ( logdate datetime, processinfo nvarchar(20), login_text nvarchar(max))

    insert into @tbl (logdate, processinfo, login_text)

    exec sp_readerrorlog

    select * , '[' + SUBSTRING( login_text , PATINDEX ( '%CLIENT:%', login_text)+7, len(login_text)) IP_Address from @tbl where login_text like '%login%'

    Thanks.

    Is there a similar sp like this one for reading all log instead of only error log?

  • You may want to examine the default trace to answer your questions. Here are a few links to assist you:

    Default trace - A Beginner's Guide

    By Adam Haines, 2010/06/11 (first published: 2008/11/11)

    at:

    http://www.sqlservercentral.com/articles/SQL+Server+2005/64547/

    and:

    SQL Server 2005, List of Events Captured by the Default Trace

    at:

    http://blogs.technet.com/fort_sql/archive/2009/10/29/sql-server-2005-list-of-events-captured-by-the-default-trace.aspx

    Further:

    Who has accessed my 2005 server?

    By Jack Corbett, 0001/01/01

    at:

    http://www.sqlservercentral.com/scripts/Auditing/64335/

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply