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

Commit 99e10df

Browse files
author
Chris Wiechmann
authored
Merge pull request #23 from Axway-API-Management-Plus/trace-messages
Optimized ES-Index storing trace-messages
2 parents 6817834 + 1ad20a7 commit 99e10df

12 files changed

+53
-20
lines changed

docker-compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ services:
55
image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
66
container_name: elasticsearch1
77
environment:
8-
- "ES_JAVA_OPTS=-Xms750M -Xmx750M"
8+
# This should be 50% of your available memory, but not more than 31GB
9+
# The remaining 50% of memory will be used by Apache Lucene
10+
- ES_HEAP_SIZE: 1g
911
ulimits:
1012
memlock:
1113
soft: -1

elk-traffic-monitor-api/test/_base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ function requestAsync(uri, options, cb) {
6666
});
6767
}
6868

69-
async function sendToElasticsearch(elasticConfig, index, dataset) {
69+
async function sendToElasticsearch(elasticConfig, index, template, dataset) {
7070
console.log(`Creating connection to ElasticSearch cluster: ${elasticConfig.node}`)
7171
const client = new Client({
7272
node: elasticConfig.node
7373
});
74-
const mappingConfig = JSON.parse(fs.readFileSync('../logstash/config/traffic_details_index_template.json')).mappings;
74+
const mappingConfig = JSON.parse(fs.readFileSync(`../logstash/config/${template}`)).mappings;
7575
const createdIndexResponse = await client.indices.create({
7676
index: index,
7777
body: {

elk-traffic-monitor-api/test/asAdmin/test_circuitpath.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Traffic Monitor API', function () {
99
this.timeout(30000);
1010
let server;
1111
let auth;
12-
const indexName = `circuitpath_test_${getRandomInt(9999)}`;
12+
const indexName = `apigw-traffic-circuitpath_test_${getRandomInt(9999)}`;
1313

1414
beforeEach(() => {
1515
// Simulate all responses in this test-file to be an admin, which will not lead to any result restriction
@@ -40,7 +40,7 @@ describe('Traffic Monitor API', function () {
4040
server.started
4141
.then(() => {
4242
const entryset = require('../documents/basic/circuitpath_test_documents');
43-
sendToElasticsearch(elasticConfig, indexName, entryset)
43+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
4444
.then(() => {
4545
resolve();
4646
})

elk-traffic-monitor-api/test/asAdmin/test_getinfo_endpoint.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Endpoints', function () {
99
this.timeout(30000);
1010
let server;
1111
let auth;
12-
const indexName = `getinfo_test_${getRandomInt(9999)}`;
12+
const indexName = `apigw-traffic-getinfo_test_${getRandomInt(9999)}`;
1313

1414
beforeEach(() => {
1515
// Simulate all responses in this test-file to be an admin, which will not lead to any result restriction
@@ -40,7 +40,7 @@ describe('Endpoints', function () {
4040
server.started
4141
.then(() => {
4242
const entryset = require('../documents/basic/getinfo_test_documents');
43-
sendToElasticsearch(elasticConfig, indexName, entryset)
43+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
4444
.then(() => {
4545
resolve();
4646
})

elk-traffic-monitor-api/test/asAdmin/test_search_count_AsAdmin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Endpoints', function () {
99
this.timeout(30000);
1010
let server;
1111
let auth;
12-
const indexName = `search_count_test_${getRandomInt(9999)}`;
12+
const indexName = `apigw-traffic-search_count_test_${getRandomInt(9999)}`;
1313

1414
beforeEach(() => {
1515
// Simulate all responses in this test-file to be an admin, which will not lead to any result restriction
@@ -40,7 +40,7 @@ describe('Endpoints', function () {
4040
server.started
4141
.then(() => {
4242
const entryset = require('../documents/basic/search_count_documents');
43-
sendToElasticsearch(elasticConfig, indexName, entryset)
43+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
4444
.then(() => {
4545
resolve();
4646
})

elk-traffic-monitor-api/test/asAdmin/test_search_endpoint_AsAdmin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('Endpoints', function () {
1010
this.timeout(30000);
1111
let server;
1212
let auth;
13-
const indexName = `search_test_${getRandomInt(9999)}`;
13+
const indexName = `apigw-traffic-search_test_${getRandomInt(9999)}`;
1414

1515
beforeEach(() => {
1616
// Simulate all responses in this test-file to be an admin, which will not lead to any result restriction
@@ -41,7 +41,7 @@ describe('Endpoints', function () {
4141
server.started
4242
.then(() => {
4343
const entryset = require('../documents/basic/search_test_documents');
44-
sendToElasticsearch(elasticConfig, indexName, entryset)
44+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
4545
.then(() => {
4646
resolve();
4747
})

elk-traffic-monitor-api/test/asAdmin/test_trace_endpoint.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Traffic Monitor API', function () {
99
this.timeout(30000);
1010
let server;
1111
let auth;
12-
const indexName = `trace_test_${getRandomInt(9999)}`;
12+
const indexName = `apigw-trace-test_${getRandomInt(9999)}`;
1313

1414
beforeEach(() => {
1515
// Simulate all responses in this test-file to be an admin, which will not lead to any result restriction
@@ -40,7 +40,7 @@ describe('Traffic Monitor API', function () {
4040
server.started
4141
.then(() => {
4242
const entryset = require('../documents/basic/trace_test_documents');
43-
sendToElasticsearch(elasticConfig, indexName, entryset)
43+
sendToElasticsearch(elasticConfig, indexName, 'trace_messages_index_template.json', entryset)
4444
.then(() => {
4545
resolve();
4646
})

elk-traffic-monitor-api/test/restricted/test_circuitpath_restricted.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Traffic Monitor API', function () {
99
this.timeout(30000);
1010
let server;
1111
let auth;
12-
const indexName = `circuitpath_test_${getRandomInt(9999)}`;
12+
const indexName = `apigw-traffic-circuitpath_test_${getRandomInt(9999)}`;
1313

1414
/**
1515
* Start API Builder.
@@ -30,7 +30,7 @@ describe('Traffic Monitor API', function () {
3030
server.started
3131
.then(() => {
3232
const entryset = require('../documents/basic/circuitpath_test_documents');
33-
sendToElasticsearch(elasticConfig, indexName, entryset)
33+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
3434
.then(() => {
3535
resolve();
3636
})

elk-traffic-monitor-api/test/restricted/test_getinfo_endpoint_restricted.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Endpoints', function () {
99
this.timeout(30000);
1010
let server;
1111
let auth;
12-
const indexName = `getinfo_test_${getRandomInt(9999)}`;
12+
const indexName = `apigw-traffic-getinfo_test_${getRandomInt(9999)}`;
1313

1414
/**
1515
* Start API Builder.
@@ -30,7 +30,7 @@ describe('Endpoints', function () {
3030
server.started
3131
.then(() => {
3232
const entryset = require('../documents/basic/getinfo_test_documents');
33-
sendToElasticsearch(elasticConfig, indexName, entryset)
33+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
3434
.then(() => {
3535
resolve();
3636
})

elk-traffic-monitor-api/test/restricted/test_search_restricted.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('Endpoints', function () {
99
this.timeout(30000);
1010
let server;
1111
let auth;
12-
const indexName = `search_count_test_${getRandomInt(9999)}`;
12+
const indexName = `apigw-traffic-search_count_test_${getRandomInt(9999)}`;
1313

1414
/**
1515
* Start API Builder.
@@ -30,7 +30,7 @@ describe('Endpoints', function () {
3030
server.started
3131
.then(() => {
3232
const entryset = require('../documents/basic/search_count_documents');
33-
sendToElasticsearch(elasticConfig, indexName, entryset)
33+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
3434
.then(() => {
3535
resolve();
3636
})

0 commit comments

Comments
 (0)