Groups | Blog | Home
all groups > dotnet security > june 2005 >

dotnet security : custom event log


<dl>
6/23/2005 12:00:00 AM
Hi Joe / Dominick
Sorry, I found it under 1.1. I just need to know how to do it in the
deployment process?! This is my first .NET application!

"Dominick Baier [DevelopMentor]" <dbaier@pleasepleasenospamdevelop.com>
[quoted text, click to view]

<dl>
6/23/2005 12:00:00 AM
Hi
Has anyone successfully created a custom event log from asp.net / simply
editing the Reg?! Can you share how, please?!

TIA

--


<dl>
6/23/2005 12:00:00 AM
Hi Dominick
I am still on 1.1, and will not be using 2.0 in the near future though!

"Dominick Baier [DevelopMentor]" <dbaier@pleasepleasenospamdevelop.com>
[quoted text, click to view]

<dl>
6/23/2005 12:00:00 AM
Hi
But do I get CreateEventSource in 1.1, I can't find it in the SDK doc? I
can only find the related documentation online and it said supported in .NET
2.0?!

[quoted text, click to view]

Dominick Baier [DevelopMentor]
6/23/2005 6:20:46 AM
Hello dl,

there is a EventLog.CreateEventSource() method. But you need administrative
privs to create an Event Source - so it will likely not work from asp.net
directly.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

[quoted text, click to view]


Dominick Baier [DevelopMentor]
6/23/2005 8:22:34 AM
Hello dl,

where did i mention 2.0 ??

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

[quoted text, click to view]


Joe Kaplan (MVP - ADSI)
6/23/2005 9:33:41 AM
What he said applies to both.

Generally with ASP.NET apps, you create your event source as part of the
deployment process and then just write to the event source from the app. If
the app attempts to create the event source itself, it will generally fail
unless you have configured ASP.NET to run as a local admin which is
generally regarded as a really bad idea.

Joe K.

[quoted text, click to view]

Joe Kaplan (MVP - ADSI)
6/23/2005 2:00:09 PM
There are a variety of ways, depending on how you want to do your
deployment. You might write a simple console app that does this that the
admin runs when they install your app. You can also be more fancy and
integrate this into a Windows installer package. Lots of options.

Joe K.

[quoted text, click to view]

Joe Kaplan (MVP - ADSI)
6/23/2005 7:59:42 PM
The only thing I'm aware of is the MSDN platform SDK documentation. As I
understand it, you need to use the message compiler to do it, but I've never
done it and have no experience with it.

As I understand it, when you create an event source with .NET, you'll get
the standard .NET framework message file associated with it.

Joe K.

[quoted text, click to view]

Joe Kaplan (MVP - ADSI)
6/23/2005 11:13:39 PM
You are asking the wrong guy (and probably the wrong newsgroup). I've never
gotten that deep into event log stuff. The most I've ever done is just
write strings and numbers for eventIDs and that has been all I've needed.

Maybe one of the platform sdk groups?

Joe K.

[quoted text, click to view]

<dl>
6/24/2005 12:00:00 AM
How can we use the standard message file or specifically the Category /
eventID? Can we customize this standard message file?
TIA
[quoted text, click to view]

<dl>
6/24/2005 12:00:00 AM
Is there any good reference in showing how to make my own message file
(category / eventID)?
TIA

[quoted text, click to view]

<dl>
6/24/2005 12:00:00 AM
I'll try, meanwhile, can you tell me what have you don't? may be that's all
I need?! what do you mean by "write strings and numbers for eventIDs"?
TIA

[quoted text, click to view]

Joe Kaplan (MVP - ADSI)
6/24/2005 8:51:52 AM
Generally, what I do is this:

In a separate application run by the admin, do something that calls
EventLog.CreateEventSource like Dominick suggested. Sometimes this is a
simple app. Another easy way to do it is to have an EventLogInstaller class
in your assembly and have the admin run InstallUtil.exe on your assembly.
This will run the installer class and create the event source.

Then, from my code, I would have something that simply calls
EventLog.WriteEntry, passing in the source you created in the step above,
the message string, log type and eventID if I wanted to use event IDs.

That is generally enough to get this working. There are a variety of other
deployment options including MSI and creating your own message files, but
this will give you basic event log functionality.

HTH,

Joe K.
[quoted text, click to view]

AddThis Social Bookmark Button