How-To (CM-Self-Hosted): Create custom event definitions or custom event logs
135
Created On 11/10/26 11:01 AM - Last Modified 11/20/26 18:11 PM
Objective
This article covers how to add custom event definitions to your CM-Self-Hosted instance for writing custom events to your Default SQL Channel.
Please see our official documentation here: Creating custom logging event definitions
Environment
Certificate Manager - Self-Hosted
Procedure
How to Add Custom Event Definitions:
- Remote into one of your TPF nodes.
- Navigate to (C:\Program Files\Venafi\Schema).
- Create a copy of (C:\Program Files\Venafi\Schema\trace.lsc) and name it (C:\Program Files\Venafi\Schema\customapp.lsc)
- Open the file (customapp.lsc) using notepad and change the following items:
- Change this line:
-
FFFF,Tracing,CyberArk Debug Trace Events
-
- To:
-
0250,CustomApp Name,Custom App Description - Use the reserved decimal range of 0200-0299; in this example we are using 0250.
-
- And then change this line to match the first event used in code:
-
FFFF0001,Debug Event,Sourcefile,Message,Line Number,Long,Column Number,Long,ThreadID,Long,,,"$Event.Text1$:$Event.Value1$ - $Event.Text2$"
-
- To:
-
02500001,CustomApp Name - Event Name,,,,,,,,,,,"$Event.Text1$:$Event.Value1$ - $Event.Text2$" - For Group ID 0250, you can assign EventIDs from 0250000 through 0250FFFF.
-
- Set the appropriate values and types where applicable. For example, the value for Text1 might have a useful meaning like Username. Adjust the "Readable Log Text" column to what the user needs to see. Keep in mind macros can be used here. See other events in VCC for examples.
- Change this line:
- Make sure to save the new file in this path: (C:\Program Files\Venafi\Schema).
- Open an elevated command prompt.
- Run this command:
-
cmd /c ""\Program Files\Venafi\Platform\LogServer.exe" -import="\Program Files\Venafi\Schema"" - In some cases, you may need to stop the LogServer service before running this command.
-
- After that completes, restart the following services:
- Venafi Log Server service.
- IIS.
- Venafi WCF Host if VCC is open.
- Open VCC and go to Events > Logging > Event Definitions > Locate your new event category.
- Process complete.
How to Remove Custom Event Definitions:
- Create a new file on your TPF server titled "RemoveLogCategory.xml".
- Add the following XML to that file:
-
<?xml version="1.0" encoding="utf-8"?> <ConfigSchema Type="RemoveLogDefinition"> <DeleteObject Parent="\VED\Logging\Event Definitions" Name="ReplaceThis" Class="Log Application" /> </ConfigSchema> - Change "ReplaceThis" with the event category you want to remove.
-
- Import the file with this command:
-
schematool.exe {local master admin} {path to RemoveLogCateory.xml} - Example command:
-
schematool.exe vcc1admin1 "C:\Program Files\Venafi\Platform\RemoveLogCategory.xml"
-
-
- After that completes, restart the following services:
- Venafi Log Server service.
- IIS.
- Venafi WCF Host if VCC is open.
- Open VCC and go to Events > Logging > Event Definitions > Notice your event definition has been removed.
- Process complete.
How to Write a Custom Event to the Default SQL Channel:
- Use the following API endpoint in your custom script or custom application to write events: (POST Log).
- You can also use VenafiPS command Write-VdcLog. See example command:
-
Write-VdcLog -CustomEventGroup 0250 -EventId 0001 ` -Text1 "Spot for Text1" ` -Text2 "Spot for Text2" ` -Value1 "9999" ` -component "\VED\Intermediate and Root Certificates\Intermediate Certification Authorities\tppshako-WS2022-SUB-CA01-CA-5 2026"
-
- After making the request, check the Default SQL Channel and notice your custom event:
- If you see a "Missing Event Translator" event, this means something was done incorrectly.
- Review the steps and try again.
- Process complete.