Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit c0f9ca3

Browse files
author
Chris Wiechmann
committed
Update OpenTrafficPipeline.conf
1 parent 869eae1 commit c0f9ca3

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

logstash/pipelines/OpenTrafficPipeline.conf

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,32 @@ filter {
2626
add_field => { "[@metadata][apiCacheKeyPrefix]" => "" } # Create a default for the cacheKeyPrefix
2727
}
2828

29-
# First, check if the document should be ignored/dropped (configured based on the apiPath or PolicyName)
30-
29+
# Check if the document should be ignored/dropped (configured based on the apiPath or PolicyName)
30+
if([transactionSummary] and [transactionSummary][path]) { # Only if a path is given (not given for instance for Scheduled-Policies)
31+
mutate {
32+
replace => { "[@metadata][ignoreField][apiPath]" => "%{[transactionSummary][path]}" }
33+
add_field => { "[@metadata][apiPath]" => "%{[transactionSummary][path]}" }
34+
}
35+
} else if ([transactionElement] and [transactionElement][protocolInfo][http][uri]) { # Additional check for the protocol, as the uri is not given for Non-HTTP legs
36+
mutate {
37+
replace => { "[@metadata][ignoreField][apiPath]" => "%{[transactionElement][protocolInfo][http][uri]}" }
38+
add_field => { "[@metadata][apiPath]" => "%{[transactionElement][protocolInfo][http][uri]}" }
39+
}
40+
} else if ([circuitPath] and [circuitPath][0][policy]) { # Policy is for instance not given for OPTIONS requests
41+
mutate { replace => { "[@metadata][ignoreField][policyName]" => "%{[circuitPath][0][policy]}" } }
42+
} else { # For everything else (e.g. JMS-Legs) perform no lookup (Set the default to not ignore)
43+
mutate { add_field => { "[isIgnoreAPI][ignore]" => "false" } }
44+
}
3145
# Create a cache key for the API either on the complete received request path or if configured, only using a specific part of the path.
46+
# It's used for the API-Details and Ignore-Lookup.
3247
# This prevents API requests with path parameters from not being cached efficiently due to their variable parameter.
3348
# Example: API-Request: /v1/get/pet/687687678, Configured-Path: /v1/get/pet - API-Details cached based on Configured-Path (/v1/get/pet)
34-
if([transactionSummary] and [transactionSummary][path]) { # Only if a path is given (not given for instance for Scheduled-Policies)
49+
if( ([transactionSummary] and [transactionSummary][path]) or ([transactionElement] and [transactionElement][protocolInfo][http][uri]) ) {
3550
ruby {
3651
id => "Set API-Cache-Key prefix"
3752
code => '
3853
cacheAPIPaths = event.get("[@metadata][cacheAPIPaths]");
39-
apiRequestPath = event.get("[transactionSummary][path]");
54+
apiRequestPath = event.get("[@metadata][apiPath]");
4055
if (cacheAPIPaths.nil? || cacheAPIPaths.empty?)
4156
event.set("[@metadata][apiCacheKeyPrefix]", apiRequestPath);
4257
return;
@@ -53,13 +68,6 @@ filter {
5368
end
5469
'
5570
}
56-
mutate { replace => { "[@metadata][ignoreField][apiPath]" => "%{[transactionSummary][path]}" } }
57-
} else if ([transactionElement] and [transactionElement][protocolInfo][http][uri]) { # Additional check for the protocol, as the uri is not given for Non-HTTP legs
58-
mutate { replace => { "[@metadata][ignoreField][apiPath]" => "%{[transactionSummary][path]}" } }
59-
} else if ([circuitPath] and [circuitPath][0][policy]) { # Policy is for instance not given for OPTIONS requests
60-
mutate { replace => { "[@metadata][ignoreField][policyName]" => "%{[circuitPath][0][policy]}" } }
61-
} else { # For everything else (e.g. JMS-Legs) perform no lookup (Set the default to not ignore)
62-
mutate { add_field => { "[isIgnoreAPI][ignore]" => "false" } }
6371
}
6472
# Create a cache key for the event, either on API-Path or Policy-Name
6573
mutate {

0 commit comments

Comments
 (0)