From f67ff102b16f4c8f5a8d4df74f8c124d84b38eec Mon Sep 17 00:00:00 2001 From: Heng Lu <79895375+ms-henglu@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:07:33 +0800 Subject: [PATCH] remove /providers API from azurerm logs only (#5) --- trace/trace.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trace/trace.go b/trace/trace.go index d2cc339..818675c 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -19,7 +19,7 @@ var providers = []provider.Provider{ provider.AzAPIProvider{}, } -var providerUrlRegex = regexp.MustCompile(`/subscriptions/[a-zA-Z\d\-]+/providers`) +var providerUrlRegex = regexp.MustCompile(`/subscriptions/[a-zA-Z\d\-]+/providers\?`) func RequestTracesFromFile(input string) ([]types.RequestTrace, error) { data, err := os.ReadFile(input) @@ -60,7 +60,7 @@ func RequestTracesFromFile(input string) ([]types.RequestTrace, error) { mergedTraces := make([]types.RequestTrace, 0) for i := 0; i < len(traces); i++ { // skip GET /subscriptions/******/providers - if traces[i].Method == "GET" && providerUrlRegex.MatchString(traces[i].Url) { + if traces[i].Method == "GET" && providerUrlRegex.MatchString(traces[i].Url) && traces[i].Provider == "azurerm" { continue }