x
login about faq Site discussion (meta-askssc)

How to implement audit trail for session log??

I need to implement audit trail for following

                    
sessionId                    
UserId                    
DisplayName                    
LoginTime                    
LogOutTime                    
SessionDuration                    
more ▼

asked Nov 09 '09 at 06:56 AM in Default

savibp gravatar image

savibp
52 5 5 7

(comments are locked)
10|1200 characters needed characters left

2 answers: sort newest

I need to do the same but cannot find a solution to this paradigm. Someone please help!

more ▼

answered Oct 18 '11 at 03:51 AM

JWDBA gravatar image

JWDBA
1

(comments are locked)
10|1200 characters needed characters left

Insert a row in the Audit Trail table when they log on. Store the ID of that in the user's Session. Update the row, using the ID stored in the Session, when they LogOff.

If they do NOT logoff its a bit more tricky - their session will, presumably, expire of its own accord XXX minutes after last activity.

You could record a "most recent activity" column too, so each time they do something you upload the Date/Time in that column; then if they don't logoff the LogOutTime will be NULL, but you will have the "most recent activity" time instead.

more ▼

answered Nov 09 '09 at 08:33 AM

Kristen gravatar image

Kristen ♦
2.2k 6 7 10

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1601
x73
x33

asked: Nov 09 '09 at 06:56 AM

Seen: 1183 times

Last Updated: Nov 09 '09 at 08:35 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.