Using grep to Find Things in the IDM Trace Log


By: geoffc

December 26, 2007 12:00 am

Reads: 290




If you use Identity Manager, you are experienced with reading a DSTrace output with the DirXML and DirXML Drivers flags on. (If you do not recognize what I am talking about, then you are not experienced with IDM – sorry.)

Finding the event you want is usually easy with a simple search. So, search in your browser on the web version of Dstrace, and that’s fine for finding specific events.

However, one big issue is this: as you get into more complex issues, you may need to see all occurences of a particular attribute. The structure of an XDS document that IDM uses does not lend itself well to simple searching with a tool like grep.

Here we move over to a Unix-style OS, since they handle text files so very, very well. There are stacks of tools available, but for the purist, less (or more), grep, and cat are all great tools. But if you grep for Full Name (trying to find all instances of the Full Name attribute in the document, which may have thousands of instances) you will get back just the line the search string occurs on.


I finally got around to reading the man page for grep and noticed two really great switches: -B and -C. For example, ‘-B 4′ will show the 4 lines before the string if found, and ‘-C 4′ will show the 4 lines following the line the string is found on.

So this command:

cat logfile.log | grep Surname -B 4 -C 4 | less 

will show each time Surname appears, from 4 lines before to 4 lines after.

This makes finding what you need much easier!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Categories: Uncategorized

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.