node-windows icon indicating copy to clipboard operation
node-windows copied to clipboard

Can't log into EventLog message with custom event id

Open explodec14 opened this issue 9 years ago • 6 comments

hey- I am trying to store in EventViewer a log message with custom event id (different from 1000). i don't see my log get updated with this message.

Anyone has any clue why?

explodec14 avatar Jul 02 '15 15:07 explodec14

Is your process running with elevated administrative privileges? This is a requirement on Windows.

coreybutler avatar Jul 02 '15 18:07 coreybutler

Yes. i opened power-shell as an administrator and ran the script. tried to do: log.info("hello world!", 1005); but the message is not there in the Event viewer

explodec14 avatar Jul 05 '15 08:07 explodec14

Sorry to drag up an old issue but i am having the same issues with this. It will not log with a custom event id number but will if its left at its default.

jdor12321 avatar Feb 05 '16 16:02 jdor12321

I've found this to be different across different versions of Windows. Which version are you running, @jdor12321?

coreybutler avatar Feb 05 '16 17:02 coreybutler

Hi @coreybutler. I'm running this on Windows 7 Enterprise with the hope of running it on Windows Server 2003 R2 or the next version up ( I can't recall the version of the server). I haven't tested this on the server yet as was hoping go get it on PC first before deploying.

jdor12321 avatar Feb 05 '16 17:02 jdor12321

Hi, I have the same problem. 1000 logs fine but any other ID does not. Yes I'm elevated. Windows 10.

Correction: After some more investigation, it appears that 1000 is the maximum ID that can be handled. Specifying any event ID number up to 1000 will work. 1001 onwards does not.

Not sure how valid this source is but It would appear that the issue is using EventCreate which only lets you generate event ids between the range of 0 - 1000. A proposed solution would be to use LogEvent which allows integers from 0 - 65535. But note: EventCreate.exe lets you create events in either System or Application logs while LogEvent events are registered only in the Application log.

https://technet.microsoft.com/en-us/library/cc755240.aspx

ianbeks avatar Mar 25 '16 11:03 ianbeks