Skip to main content

.NET Programming: Jumpstart ETW (Event Tracking for Windows)

To get started with ETW I highly recommend this pluralsight course by Kathleen Dollard. It gives you a really good introduction, including background and some examples. It will be much harder to succeed just by googling or reading books.

I will not spoil anything from this course. Here I will just give a few more hints and annotations to show where I struggled with ETW, to help you not doing the same mistakes. After finishing the pluralsight course I was really eager to get going with my own implementation but I ran into some annoying trapped doors.

Nuget package for EventSource

The current nuget package for EventSource (Vers. 1.0.16) will create the manifest file automatically (it validates your implementation upfront, only when validation succeeds manifest file will be created. Otherwise there will be no updated or no new manifest file in your bin folder!). Therefore there is no need to create it by hand.

wevtutil.exe

Running wevtutil.exe without parameters to see its help, produces this output on my console:


But all necessary commands are working. I am still investigating into this issue. But it will not effect the needed functionality, all operations worked fine for me.

In the beginning I had some trouble with wevtutil.exe
  • Making spelling mistakes
  • Specifying dll file instead of man file
  • And wrong paths (copy paste issues)
Doing these mistakes will lead into error messages like this:


Seeing these error messages for the first time confused me:

`At column=0, The system cannot locate the resource specified. Failed to load xml document`

The message made me thinking about something was wrong in my implementation in my manifest file. Maybe wrong or missing resources for translation, something in this direction. But its just talking about the parameters for wevtutil and indicates you are specifing a file that is not existing (as already described above spelling mistake in one of the paths or specified dll instead of man file and so on).

EventSource names

I had some issues specifing a “valid” EventSource name. I specified a name like this “MyCompany-MyApplication-MyEvents”. I was wondering why the regarding nested folder was not created. I could just see this entry far in the bottom in the Event Viewer:


But when I tried to open the regarding log I received this message:


The solution was really simple. There was already an existing Eventlog with the name “MyCompany” created by another application:


In this case you cannot create a nested folder with the same name. Makes sense, but a better error message would be helpful.

Maintenance for builds and installed manifests

  • Renaming and building EventSources will create new dll and man files in your build folder but it will not remove the old files. I always delete the content of my build folder when I do changes to keep the overview.
  • You need to keep your custom event sources (dll files) in installation folder (when you remove it, your views in Event Viewer will look strange), you better create a suitable folder for it. Keep man files there too, to be able to uninstall the events (I could not find a way to remove my custom events without man files).

Last but not least

Finally you should definitely checkout this nuget package with more EventSource examples.

Popular posts from this blog

How to integrate AVM smart devices into HomeKit by using openHAB

After some evaluating openHAB (Vers. 2.2.0) on my NAS I wanted to do it right and started with this  (German) article to use openHABian together with a Raspberry Pi.My primary goal was to integrate my AVM smart home devices  to control them with HomeKit . To get started I used the following items: Raspberry PI SD Card 16 GB And the following software (I used a Mac, so you might need to replace some tools if you use another OS): Download the latest openHABian image here . This is a dedicated linux distribution to provide an openHAB server. Download SD Formatter here . Needed to format your SD card. Download Etcher here . Needed to install the openHABian image on the SD card. Installation openHABian Insert the SD card Connect the Raspberry Pi via LAN with your network Plugin the Raspberry Pi Wait about 45 minutes until all updates were installed When everything went well you should be able to connect to http://openhabianpi:8080 Connect via ssh: ssh openh...

Have you ever reconsidered your personal iPhone security policy?

Why should I reconsider my iPhone security policy? I have my iPhone four digit pass code and Find my iPhone feature feature is activated. So how should abuse be possible? What could a thief be doing with my stolen iPhone? Well, possibly quite a lot. At least the bold print bullets in this article should be mandatory for everyone. Of course this is no guarantee for invulnerability but it will improve your security. After watching this video you should consider the following actions: Change your Apple ID rescue mail address and do not add this mail account to your iPhone. Consider to use a proper and usable password policy for your Apple ID like this or this (German article) . Consider a complex pass code for your iPhone. As you can see in the video four digit pass codes can be hacked in no time on iPhone 4. For newer iPhone a leak is not yet known but it is properly there. Definitely do not use these pass codes . Alternative to point three: activate delete iPhone after 10 wrong...

Two annoying issues in Visual Studio regarding XSDs and WCF should be fixed immediately

In my daily work I am always stumbling on two annoying features in Visual Studio, and I think it could be improved easily. Here is what I am complaining about. WCF Test Client WCF Test Client might be a nice tiny tool for small WCF tests, especially when you are testing smaller scenarios or when you are starting to learn how to implement web services with .NET. But it can be very annoying when you are working on more advanced stuff and your are testing with your local IIS. WCF Test Client always(!) starts automatically when you press F5 for debugging and your opened .svc.cs file has the focus: When I have configured local IIS is the target for debugging, then I expect my application will start with local IIS and not with WCF Test Client. Always. Here is my first urgent request: Please give me an option to disable WCF Test Client completely! Update 03.03.2014: Workaround for WCF Test Client Issue Select project file -> Right click -> Properties -> Web -> Sele...