Collect Logging Data in Azure Application Insights

You can use the Azure Application Insights application performance management service to collect logging information independently from the trace.log local file. If you want to centralize your logs, you can configure multiple machines on the same cluster to send their logging information to the same Application Insights subscription.

NOTE  
Logs saved to the local trace.log file are visible instantly. Messages sent to Azure Application Insights might be visible after a short delay ranging from seconds to minutes.

Prerequisites

An Azure Application Insights subscription.

Configuration

Azure Application Insights Logging Configuration

To configure Application Insights logging, use the feature-logging-azure-appinsights key in the <appSettings> node in the web.config file:

Copy
<appSettings>
...
    <add key="feature-logging-azure-appinsights" value="enabled=1; apiKey=API_KEY; logLevel=Warning; flushInterval=1m">
...
</appSettings>
 
Values Data Type Default Value Description
enabled boolean 0 Enables or disables Azure Application Insights logging: true/false, on/off, 0/1.
apiKey guid string empty Instrumentation Key from your Azure Application Insights subscription.
logLevel string Error Minimum logging level. Possible values: Fatal, Error, Warning, Information, Debug, Verbose.
IMPORTANT!  
Specifying a log level greater than Warning, may flood Azure Application Insights with irrelevant information. It is not recommended to enable Azure Application Insights logging on development environments.
flushInterval timespan 1m Delay between message batches sent to Azure, to be specified in .NET Timespan format or in Jira timespan format: 1h, 1d, 1h30m, 00:00:05, etc.

Azure Application Insights Telemetry Configuration

Telemetry is enabled by default. To disable Azure Application Insights telemetry, use the feature-logging-azure-appinsights-telemetry-disabled key in the <appSettings> node in the web.config file:

Copy
<appSettings>
...
    <add key="feature-logging-azure-appinsights-telemetry-disabled" value="1"/>
...
</appSettings>
 
NOTE  
Deactivating telemetry does not affect logging.

Collected Data

The following application specific information is saved for each log entry as part of custom dimensions:

  • MachineName
  • CorrelationId
  • Language
  • AutomationScript
  • AutomationScriptLibrary
  • SQL
  • ExtraErrorDetails

Severity Levels

Log entries with severity levels Warning, Information, Debug, or Verbose are saved as traces.

Log entries with severity levels Exception or Fatal are saved as exceptions.

Information Severity Level Examples

  • All calls to the log Server SDK function executed from automation scripts.
  • Sucess/Error status for http get/post calls to external APIs executed from automation scripts.
  • Authentication errors and information for AD and EBS providers.

Warning Severity Level Example

Missing or missmatched configuration.

Error Severity Level Examples

  • Runtime exceptions with full stack trace.
  • Errors in automation scripts. These errors include the automation script name, line, and column from the JavaScript code.
  • Application custom errors.
  • Authentication errors and information for OpenID providers.