Share via

Mask a span / attribute using Telemetry processor

Racheal 6 Reputation points
2024-02-01T08:46:36.9333333+00:00

HI, we are using application insight agent to send log to Azure. we need to mask some log. Am trying to maks a request http.url using below configuration but it isnt working .

       
},
        "level": "DEBUG"
    },	
	"preview": {
		"processors": [
		  {
			"type": "attribute",
			"actions": [
			  {
				"key": "http.url",
				"pattern": "userid=(.*)",
				"replace": "userid=xxxx",
				"action": "mask"
			  }
			]
		  }
		]
	  }


http.url = 'http.url = 'https://xxxx/health?userid=123456'

Azure Monitor
Azure Monitor

An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.


1 answer

Sort by: Most helpful
  1. Monalla-MSFT 13,166 Reputation points Moderator
    2024-02-07T13:35:15.4566667+00:00

    @Racheal - Welcome to Microsoft Q&A and thanks for reaching out to us.

    Thank you for sharing the configuration snippet! Let’s take a closer look at it.

    The provided configuration is in JSON format and is meant to configure a telemetry processor for Application Insights. It aims to mask the http.url attribute by replacing any occurrences of userid= with userid=xxxx.

    • "type": "attribute": Indicates that this processor operates on attributes.
    • "key": "http.url": Specifies the attribute key (in this case, http.url) to be processed.
    • "pattern": "userid=(.*)": Defines a regular expression pattern to match occurrences of userid= followed by any characters.
    • "replace": "userid=xxxx": Specifies the replacement value for the matched pattern (i.e., replacing it with userid=xxxx).
    • "action": "mask": Indicates that the matched value should be masked.

    Make sure you’ve correctly integrated this configuration within your Application Insights setup. If you encounter any issues, double-check the placement, and ensure that the processor is applied to the telemetry data. Remember that telemetry processors are powerful tools, but they require careful configuration to achieve the desired outcome. Hope this helps. and please feel free to reach out if you have any further questions.


    If the above response was helpful, please feel free to "Accept as Answer" and click "Yes" so it can be beneficial to the community.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.