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

Commit 381816a

Browse files
author
Chris Wiechmann
committed
Making the memcached host configurable
1 parent 256358f commit 381816a

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

.env

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ LOGSTASH=logstash:5044
5454
# used to cache the API-Details that has been looked up from the API-Manager via the API-Builder.
5555
# Even if the API-Builder is already caching the result, this improves ingest performance.
5656
# The default parameter works when using the docker-compose.yml
57-
# Comment this parameter if you dont want to use memcached at all.
58-
MEMCACHED=memchached:11211
59-
57+
MEMCACHED=memcached:11211
6058

6159
# ----------------------------------------------------------------------------------------------
6260
# This is an optional parameter used by Filebeat to set a proper name. This allows for instance

.github/workflows/logstash.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717
image: memcached:1.6.6-alpine
1818
ports:
1919
- 11211:11211
20-
env:
21-
MOCK_LOOKUP_API: true
2220

2321
steps:
2422
- uses: actions/checkout@v2

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ services:
7979
- PIPELINE_WORKERS=1
8080
- XPACK_MONITORING_ELASTICSEARCH_HOSTS=["elasticsearch1:9200"]
8181
- API_BUILDER_URL=${API_BUILDER_URL}
82+
- MEMCACHED=${MEMCACHED}
8283
ports:
8384
- 5044:5044
8485
volumes:

logstash/pipeline/pipeline.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ filter {
6666
}
6767
# If we have a ServiceConext we have to enrich it with the API-Details
6868
if([transactionSummary][serviceContext]) {
69-
# Create a key for the API
69+
# Create a key for the API
7070
mutate {
7171
add_field => { "apiCacheKey" => "%{[transactionSummary][path]}" }
7272
}
7373
# Lookup the cache with the created API-Key (API-Name---API-Path)
7474
memcached {
75-
hosts => ["memcached"]
75+
hosts => "${MEMCACHED}"
7676
namespace => "api_details"
7777
get => { "%{apiCacheKey}" => "[apiDetails]" }
7878
}
@@ -85,7 +85,7 @@ filter {
8585
"apiPath" => "%{[transactionSummary][path]}"
8686
}
8787
target_body => "apiDetails"
88-
add_field => { "updateAPICache" => "true" }
88+
add_field => { "[@metadata][updateAPICache]" => "true" }
8989
}
9090
}
9191
# At this point we should have the apiDetails either from the cache or looked up via HTTP
@@ -99,9 +99,9 @@ filter {
9999
}
100100
}
101101
# If the API has been looked up add it to the cache
102-
if([updateAPICache]=="true") {
102+
if([@metadata][updateAPICache]=="true") {
103103
memcached {
104-
hosts => ["memcached"]
104+
hosts => "${MEMCACHED}"
105105
namespace => "api_details"
106106
ttl => 3600
107107
set => { "[apiDetails]" => "%{apiCacheKey}" }

0 commit comments

Comments
 (0)