{"title":"Creating custom telemetry events for event log monitoring","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-instrument-application-for-telemetry-event-log/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-instrument-application-for-telemetry-event-log, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-instrument-application-for-telemetry-event-log","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Create custom telemetry events with SendTraceTag in Business Central on-premises, view them in Windows event logs, and control logging severity.","date":"2026-11-17","meta":{"topic":"concept-article"},"outline":[{"level":1,"title":"Creating custom telemetry events for event log monitoring","slug":"creating-custom-telemetry-events-for-event-log-monitoring","at":0,"chars":5062},{"level":2,"title":"Create custom telemetry events","slug":"create-custom-telemetry-events","at":611,"chars":2757},{"level":2,"title":"View and collect telemetry data","slug":"view-and-collect-telemetry-data","at":3368,"chars":1472},{"level":2,"title":"Related information","slug":"related-information","at":4840,"chars":222}],"text":"# Creating custom telemetry events for event log monitoring\n> APPLIES TO: Business Central on-premises.\nThis article explains how to create custom telemetry trace events in AL code that will be sent to the Event Log of the Business Central Server machine.\n> NOTE\n> The SendTraceTag method is marked as obsolete in Business Central 2020 release wave 2 (v17). You can still use it, but we recommend that you send traces to Application Insights using the LogMessage method instead. See Creating Custom Telemetry Traces for Application Insights Monitoring<devenv-instrument-application-for-telemetry-app-insights>.\n## Create custom telemetry events\nTo create a custom telemetry event, you use the methods-auto/session/session-sendtracetag-method in code. You can use the SendTraceTag method in any object, trigger, or method. The SendTraceTag method has the following syntax:\n```al\nSENDTRACETAG(Tag, Category, Verbosity, Message[, DataClassification])\n```\nYou use the parameters to define the information about the telemetry trace event. This information can be consumed by event logging tools and presented in different ways.\nParameter|Description\nTag|A text string that assigns an identifier to the telemetry trace event. The tag can consist of letters, numbers, and special characters. Business Central system telemetry events use an auto-generated, auto-incremented, 7-character tag that includes numbers and letters, such as 000002Q and 000013P. Try to make your tags unique from these telemetry event tags by, for example, using at least 8 characters or a prefix, like Cronus-0001 and Cronus-0002.\nCategory|A text string that assigns the telemetry trace event to a category that you define. For example, you could have a category for upgrading, user activity, or reporting.\nVerbosity|An enumeration that specifies the severity level of the telemetry trace event. The value can be Critical, Error, Warning, Normal, or Verbose. This severity level can be used by Business Central Server to filter out lower-level telemetry trace events from being emitted. See Viewing and collecting telemetry data<#ViewTelemetry>.\nMessage|A text string that specifies the descriptive message for the telemetry trace event.\nDataClassification|A DataClassification data type that assigns a classification to the telemetry trace event. Learn more in the Business Central developer documentation<../developer>.\nFor example, the following code creates simple telemetry trace events for the five different severity levels.\n```al\nSENDTRACETAG('Cronus-0001', 'Action', VERBOSITY::Critical, 'This is a critical message.', DATACLASSIFICATION::CustomerContent);\nSENDTRACETAG('Cronus-0002', 'Action', VERBOSITY::Error, 'This is an error message.',  DATACLASSIFICATION::EndUserIdentifiableInformation);\nSENDTRACETAG('Cronus-0003', 'Action', VERBOSITY::Warning, 'This is a warning message.', DATACLASSIFICATION::AccountData);\nSENDTRACETAG('Cronus-0004', 'Action', VERBOSITY::Normal, 'This is an informational message.', DATACLASSIFICATION::OrganizationIdentifiableInformation);\nSENDTRACETAG('Cronus-0005', 'Action', VERBOSITY::Verbose, 'This is a verbose message.', DATACLASSIFICATION::SystemMetadata);\n```\nFor a simple test of this code, add it to the OnRun trigger of a codeunit, and then run the codeunit. Of course, you can also call the code from other objects, triggers or functions as well.\n## View and collect telemetry data\nViewing and collecting telemetry data is done the same way as with other trace events emitted by Business Central, for example, by using tools like Event Viewer, Performance Monitor, PerfView, or logman.\n In Event Viewer, telemetry trace events can be viewed from Applications and Services Logs > Microsoft > DynamicsNAV > Common. The Admin log records events with severity levels of Warning, Error, and Critical. Normal and Verbose events use the Debug log, which must be enabled to view them. The TraceLevel setting must also allow the event's severity.\n  See Monitoring Business Central Server Events Using Event Viewer<../administration/monitor-server-events-windows-event-log>.\n With other tools like Performance Monitor, PerfView, and logman, you can collect telemetry data by using Microsoft-DynamicsNAV-Common as the event trace provider.\n  See Get Started Monitoring Events<../administration/monitor-server-events#GetStartedEvents>.\n> IMPORTANT\n> The Business Central Server instance includes a configuration setting called TraceLevel in the customsettings.config file. Use this setting to specify the lowest severity level of telemetry events to record in the event log, or to turn off telemetry event logging altogether. If you don't see the expected events, verify the Business Central Server instance configuration with an administrator. See Configuring Business Central Server<../administration/configure-server-instance>.\n## Related information\ndevenv-instrument-application-for-telemetry\nMonitoring and Analyzing Telemetry<../administration/telemetry-overview>\nMonitoring Business Central Server Events<../administration/monitor-server-events>"}