Home > other >  Attributes MS_ appears in the property name in ApplicationInsights
Attributes MS_ appears in the property name in ApplicationInsights

Time:01-25

After logging information in ApplicationInsights using a Serilog, the following attributes MS_ appears in the property name. What does it mean and can it be removed?

MS_OperationContext MS_HostInstanceId MS_FunctionName

CodePudding user response:

After logging information in ApplicationInsights using a Serilog, the following attributes MS_ appears in the property name. What does it mean and can it be removed?

It seems its property naming or custom dimension naming convention is by design that way, i.e. MS_PropertyName


namespace Microsoft.Azure.WebJobs.Logging
{
    /// <summary>
    /// A collection of constants used for logging scope keys.
    /// </summary>
    public static class ScopeKeys
    {
        /// <summary>
        /// A key identifying the function invocation id.
        /// </summary>
        public const string FunctionInvocationId = "MS_FunctionInvocationId";

        /// <summary>
        /// A key identifying the function name.
        /// </summary>
        public const string FunctionName = "MS_FunctionName";

        /// <summary>
        /// A key identifying the event starting with the current scope
        /// </summary>
        public const string Event = "MS_Event";

        /// <summary>
        /// A key identifying the current host instance.
        /// </summary>
        public const string HostInstanceId = "MS_HostInstanceId";

        /// <summary>
        /// A key identifying the current invocation trigger details.
        /// </summary>
        public const string TriggerDetails = "MS_TriggerDetails";
    }
}

You can refer to Custom dimension in app insight changed name for FunctionName, ScopeKeys.cs and LogWarning shows LogLevel as Information

CodePudding user response:

But why is this naming used specifically when logging is with Serilog? When logging via TelemetryClient directly, these properties are named without MS_.

  •  Tags:  
  • Related