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

Commit cabf0b5

Browse files
author
Chris Wiechmann
committed
Cache handling for index-status fixed
1 parent 9ffd6c0 commit cabf0b5

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ into the main policy: `Protect Management Interfaces` and wire it like shown her
288288
It is recommended to disable the audit log for Failure transactions to avoid not needed log messages in the ANM trace file:
289289
<p align="center"><img src="imgs/policy-shortcut-disable-failure.png" alt="Use Elasticsearch API" width="300" height="123"></p>
290290

291-
- :point_right: Before you restart the Admin-Node-Manager process, please open the file: `<apigateway-install-dir>/apigateway/conf/envSettings.props` and add the following new environment variable: `API_BUILDER_URL=https://apibuilder4elastic:8443`.
291+
- :point_right: Before you restart the Admin-Node-Manager process, please open the file: `<apigateway-install-dir>/apigateway/conf/envSettings.props` and add the following new environment variable: `env.API_BUILDER_URL=https://apibuilder4elastic:8443`.
292292
- :point_right: If you are using [multiple regions](#different-topologiesdomains) you may also configure the appropriate region to restrict the data of the Admin-Node-Manager to the correct regional data. E.g.: `REGION=US`.
293293
- :point_right: Please remember to copy the changed Admin-Node-Manager configuration from the Policy-Studio project folder (path on Linux: `/home/<user>/apiprojects/\<project-name\>`) back to the ANM folder (`\<install-dir\>/apigateway/conf/fed`). Then restart the ANM.
294294

@@ -898,20 +898,20 @@ Or the following:
898898
```
899899

900900
### No results from Elasticsearch
901-
If you don't get any results from Elasticsearch for valid queries the template might not be used correctly during index creation. Elasticsearch does not execute queries on the original document, rather on the indexed fields. How these were indexed is defined by an index mapping.
901+
If you don't get any results from Elasticsearch for valid queries an [index template](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/index-templates.html) might not be applied correctly during index creation. You need to know, that Elasticsearch does not execute queries on the original document, rather on the indexed fields. How these were indexed is defined by an index mapping.
902902
For this purpose, the solution delivers an index template for each index, which is used when the index is created.
903903
You can find the index mapping in the API-Builder container: `elasticsearch_config/<index-name>/index_template.json` or you can review them [here](apibuilder4elastic/elasticsearch_config).
904904
To check if the index mapping was applied correctly to an index execute the following request. For example the Traffic-Summary index:
905905
`http://elasticsearch:9200/apigw-traffic-summary/_mapping`
906-
then check if individual properties have the mapping from the template.
906+
then check if properties mappings defined in the configuration mentioned above have been applied to the index.
907907

908908
### Check API-Builder processing
909909
The API-Builder docker container is running
910910
```
911-
docker logs apigateway-openlogging-elk_elk-traffic-monitor-api_1_3fbba4deea37 --follow
911+
docker logs apibuilder4elastic --follow
912912
```
913913
```
914-
server started on port 8080
914+
server started on port 8443
915915
```
916916
### Check requests from Admin-Node-Manager
917917
When using the API-Gateway Traffic-Monitor to monitor requests and having the Admin-Node-Manager re-configured you should see how API-Builder is processing the requests:
@@ -973,6 +973,7 @@ VALUE version_status:versionCheck 1 89
973973
{I"
974974
message:ETI"'Filebeat and Logstash version okay;TI"versionStatus;TI"ok;T
975975
END
976+
```
976977

977978
You can find additional information here: https://techleader.pro/a/90-Accessing-Memcached-from-the-command-line. You may also use [PHPMemcachedAdmin](https://github.com/elijaa/phpmemcachedadmin) to get insights about the Memcache instance.
978979

logstash/pipelines/BeatsInputPipeline.conf

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,12 @@ filter {
8686
target_body => "indicesStatus"
8787
add_field => { "[@metadata][updateCache]" => "true" }
8888
}
89-
} else {
90-
# Set a flag that is used only by "Logstash tests" to validate the information was looked up from the cache
91-
if ([integrationTest]) {
92-
mutate {
93-
add_field => { "[cachedResponse]" => "true" }
94-
}
95-
}
9689
}
9790
# If the API-Builder create index API has been called, create a cache entry to avoid further unneeded calls
9891
if([@metadata][updateCache]=="true") {
92+
ruby {
93+
code => 'logger.info("Adding index status to cache: ", "value" => event.get("[indicesStatus]"), "logtype" => event.get("[logtype]"), "region" => event.get("[gatewayRegion]"));'
94+
}
9995
memcached {
10096
hosts => "${MEMCACHED}"
10197
namespace => "index_status"

0 commit comments

Comments
 (0)