SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Auditing Logins in Sql Server 2005


Auditing Logins in Sql Server 2005

Author
Message
chinn
chinn
SSC-Addicted
SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)

Group: General Forum Members
Points: 476 Visits: 710
Hello All,

I am using the below code to caputre logins it works great.
http://www.sqlservercentral.com/articles/SQLServerCentral/sqlserver2005logontriggers/2366/

I wanted a piece of code in the stored proc to acheive the below...

If a particuare username already exists in the "Logging" table in a day.
I dont want to capture/insert it again.

This way i am trying to eliminate duplicate captures and maintain the size of the table or if there is a better way to do this.Please let me know.

Any suggestions would be greatly appreciated.



Thanks in Advance!



Steve Jones
Steve Jones
SSC Guru
SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)

Group: Administrators
Points: 141129 Visits: 19415
you could easily check to see if the person had already logged in on that day by checking user name, day, month, year before inserting.

However, are you trying to just see who logged in during a particular day? If so, how does that help you with auditing?

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
chinn
chinn
SSC-Addicted
SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)

Group: General Forum Members
Points: 476 Visits: 710
Steve,
Thanks For Your Reply!

We are primarily using this to remove unused id's on a Server .If a login has not been used for 90 days we want to look at it and talk to application team and remove if not necessary any more.

I wanted to check before inserting...but i couldnt figure it out....

Thanks Again...



Clive Strong
Clive Strong
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2747 Visits: 6622
Steve nailed it.

However, I'm not sure if this would be applicable in your environment, but we had one user who used their login credentials in an excel spreadsheet and this was still active after he left.

We're only a small company, so I know who is here and who has since left...For a company with hundreds or thousands of users, you might well cross reference your login list against an HR employee list to see if you have any applications using logins which need removing.
Steve Jones
Steve Jones
SSC Guru
SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)SSC Guru (141K reputation)

Group: Administrators
Points: 141129 Visits: 19415
The check should work

if exists (select from ... day = day, month = month, etc.)

Then I'd disable those not used for 90 days, but I wouldn't remove something until 365 days had passed. I've been burned by those once a year processes before.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
chinn
chinn
SSC-Addicted
SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)SSC-Addicted (476 reputation)

Group: General Forum Members
Points: 476 Visits: 710
Thanks Steve!

Thanks For The Tip...



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search