Create Custom Event Source Using Regedit
Creating a custom event source inside the Windows Application log
allows your custom scripts, services, or software to write dedicated,
easily identifiable messages directly into the Windows Event Viewer.
This guide provides a straightforward, step-by-step walkthrough on how
to manually register a new event source under the Application log by
creating the appropriate keys and values using the Windows Registry
Editor (regedit).
Step 1: Open the Registry Editor
- Press
Win + Rto open the Run dialog. - Type
regeditand pressEnteror click OK. - If prompted by User Account Control (UAC), click Yes to run the editor with administrative privileges.
Step 2: Navigate to the Application EventLog Key
Use the left navigation pane to browse to the following registry path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application
Step 3: Create the New Event Source Key
- Right-click the Application key in the left pane.
- Select New > Key.
- Name the new key with the exact name you want for your event source
(for example,
MyCustomApp).
Step 4: Configure the Event Source Values
To ensure Windows correctly formats and handles the event messages generated by your source, add the following values inside your new key:
Select your new key (e.g.,
MyCustomApp).Right-click the empty space in the right pane, select New > Expandable String Value, and name it
EventMessageFile.Double-click
EventMessageFileand set its Value data to the path of a message DLL that handles standard text messages. A common default for standard Windows events is:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\EventLogMessages.dllRight-click the empty space in the right pane again, select New > DWORD (32-bit) Value, and name it
TypesSupported.Double-click
TypesSupported, set the Base to Hexadecimal, and enter7(or1fto support all event types including Audit Success/Failure, Error, Warning, and Information). Click OK.
Step 5: Verify the Event Source
You can verify that the custom event source is functioning by writing a test event using PowerShell:
Open PowerShell as Administrator.
Run the following command:
Write-EventLog -LogName Application -Source "MyCustomApp" -EntryType Information -EventId 1001 -Message "Test event log entry."Open Event Viewer (
eventvwr.msc), navigate to Windows Logs > Application, and verify your event appears with the source nameMyCustomApp.