Welcome to MSDN Blogs Sign in | Join | Help

LDAP client tracing...

ADinsight from the sysinternals toolset is a great tool , but I seem to have problems  with it at times. Specifically on Server 2008  & Vista (maybe due to the way it hooks wldap32.dll)

On Vista OS and beyond, there is built in client ldap tracing which can give you similar results  ( with a wee bitmore effort )

In order to start the trace you use tracelog.exe ( may be able to use logman.exe as well but I have not tried it )

First , create a new key under HKLM\System\CurrentControlSet\Services\ldap\tracing\

 

The key name should be the name of the .exe you want to trace ,  mmc.exe for example.

C:\tools>Tracelog.exe -start ldap -guid #099614a5-5dd7-4788-8bc9-e29f43db28fc -f  ldap.etl  -flag x1FFFDFF3

 

Logger Started...

Enabling trace to logger 23

Operation Status:       0L      The operation completed successfully.

 

Logger Name:            ldap

Logger Id:              0x17

Logger Thread Id:       00000EDC

Guid:                   4a9f73a0-649c-11dd-84e5-0003ff1ee008

Buffer Size:            16 Kb

Maximum Buffers:        25

Minimum Buffers:        3

Number of Buffers:      3

Free Buffers:           2

Buffers Written:        1

Events Lost:            0

Log Buffers Lost:       0

Real Time Buffers Lost: 0

AgeLimit:               0

Real Time Consumers:    0

ClockType:              PerfCounter

Log Mode:               Sequential

Maximum File Size:      not set

Buffer Flush Timer:     not set

Log Filename:           C:\tools\ldap.etl

 

After your repro or whatnot, when you want to stop the trace use the following command:

C:\tools>tracelog -stop ldap

 

Operation Status:       0L      The operation completed successfully.

Logger Name:            ldap

Logger Id:              0x17

Logger Thread Id:       00000EDC

Guid:                   4a9f73a0-649c-11dd-84e5-0003ff1ee008

Buffer Size:            16 Kb

Maximum Buffers:        25

Minimum Buffers:        3

Number of Buffers:      4

Free Buffers:           4

Buffers Written:        1

Events Lost:            0

Log Buffers Lost:       0

Real Time Buffers Lost: 0

AgeLimit:               0

Real Time Consumers:    0

ClockType:              PerfCounter

Log Mode:               Sequential

Maximum File Size:      not set

Buffer Flush Timer:     not set

Log Filename:           C:\tools\ldap.etl

In order to format the trace to a readable format use tracerpt.exe

C:\tools>tracerpt.exe ldap.etl -o ldap2.csv -of CSV

 

Input

----------------

File(s):

     ldap.etl

100.00%

Output

----------------

DumpFile:           ldap2.csv

The command completed successfully.

 

 

 

Now, open the CSV in excel . There is a whole gob of information, but I have found that if I filter the Event ID column I can easily get what I want from it.

Below I filter on ID = 20

 

image

 

 

Have fun with it... works nicely in a pinch when you don't have any other tools at your disposal except for the built in ones. Also works nice for the detailed returns and code flow, as well as how much time it took to perform.

 

spat

 

Published Tuesday, August 12, 2008 7:37 AM by SpatDSG
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Tuesday, August 12, 2008 2:06 PM by Brandon

# re: LDAP client tracing...

Hmmm... looks like a job for Powershell :)

Tuesday, August 12, 2008 4:14 PM by SpatDSG

# re: LDAP client tracing...

LOL - you and your powershell.  OK I'll admit - it is pure laziness on my part for not learning PS yet...  convince me to repriortize it.

spat

Wednesday, August 13, 2008 5:57 PM by Brandon

# re: LDAP client tracing...

Challenge taken :) stay tuned!

Wednesday, August 13, 2008 10:11 PM by Brandon

# re: LDAP client tracing...

So.. here is a question. I can't seem to get the GUID to work for me (even in cmd.exe)

Wednesday, August 13, 2008 10:13 PM by Brandon

# re: LDAP client tracing...

whoops.. sure the error message may be helpful

C:\data\Tools>Tracelog.exe -start ldap -guid #099614a5-5dd7-4788-8bc9-e29f43db28fc -f  ldap.etl  -flag x1FFFDFF3

Getting guids from C:\data\Tools\#099614a5-5dd7-4788-8bc9-e29f43db28fc

Error: C:\data\Tools\#099614a5-5dd7-4788-8bc9-e29f43db28fc is invalid

Wednesday, August 13, 2008 11:15 PM by Brandon

# re: LDAP client tracing...

nm... apparently my version from 1999 was old :) I am good now.

btw... I should the Powershell script posted tomorrow. Its HOT IMO :)

Thursday, August 14, 2008 9:53 PM by Brandon

# re: LDAP client tracing...

My blog post response

http://bsonposh.com/archives/347

Wednesday, August 20, 2008 12:00 PM by joe

# re: LDAP client tracing...

Hey Steve, do you know if there is an equivilent tracing functionality to capture the server side part? That would be extremely useful, especially when you have the UNIX people coming for your head because "AD is Broken". ;)

Monday, August 25, 2008 12:13 PM by SpatDSG

# re: LDAP client tracing...

There has been some form of tracing for DS since Win2k.. but it's not the friendliest of data. I'll look into either a better collection of data in 2k8 or simply post a follow up of the Win2k+ tracing available..

spat

Tuesday, September 23, 2008 5:21 PM by Tony Murray

# re: LDAP client tracing...

In answer to Joe's question, you can use the Windows Server 2008 Reliability and Performance Monitor to trace AD activity.  I've covered this here:

http://www.activedir.org/Articles/tabid/54/articleType/ArticleView/articleId/49/Default.aspx

Along with the htm and xml output files that are created you also have etl trace files.  If you dump these to CSV using tracerpt as Spat shows above, you can see the LDAP activity.

Tuesday, February 03, 2009 7:13 AM by James

# re: LDAP client tracing...

Could you blog on how Microsoft ADAM supports referential integrity?

https://www.opends.org/wiki/page/MaintainingReferentialIntegrity

Friday, August 07, 2009 11:16 AM by Yann

# re: LDAP client tracing...

Hello,

When i execute the command Tracelog.exe -start ldap -guid #099614a5-5dd7-4788-8bc9-e29f43db28fc -f  ldap.etl  -flag x1FFFDFF3

i have this result:

Getting guids from C:\WINDOWS\system32\#099614a5-5dd7-4788-8bc9-e29f43db28fc

Error: C:\WINDOWS\system32\#099614a5-5dd7-4788-8bc9-e29f43db28fc is invalid

Any clue ?

thx

Monday, August 10, 2009 3:07 PM by SpatDSG

# re: LDAP client tracing...

get the newer version of tracelog - see the previous comment from Bshell

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker