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

Commit 33c7835

Browse files
author
Chris Wiechmann
committed
Making API-Builder flow-node names more unique
1 parent ccb1057 commit 33c7835

File tree

5 files changed

+28
-25
lines changed

5 files changed

+28
-25
lines changed

elk-traffic-monitor-api/flows/trafficMonitorApi-circuitpath.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"nodes": {
3535
"elasticsearch.1": {
3636
"type": "nodehandler://@axway-api-builder-ext/api-builder-plugin-fn-elasticsearch/elasticsearch",
37-
"name": "Search",
37+
"name": "Search Circuitpath",
3838
"method": "search",
3939
"parameters": [
4040
{
@@ -72,7 +72,7 @@
7272
},
7373
"http.2": {
7474
"type": "nodehandler://axway-flow/http",
75-
"name": "HTTP Query Response",
75+
"name": "Return Circuitpath response",
7676
"method": "setresponse",
7777
"parameters": [
7878
{
@@ -101,7 +101,7 @@
101101
},
102102
"javascript.1": {
103103
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
104-
"name": "Format result",
104+
"name": "Format Circuitpath result",
105105
"method": "Execute",
106106
"parameters": [
107107
{
@@ -139,7 +139,7 @@
139139
},
140140
"javascript.2": {
141141
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
142-
"name": "Define Index",
142+
"name": "Define circuitpath Index",
143143
"method": "Execute",
144144
"parameters": [
145145
{
@@ -177,7 +177,7 @@
177177
},
178178
"javascript.3": {
179179
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
180-
"name": "Build Query",
180+
"name": "Build Circuitpath Query",
181181
"method": "Execute",
182182
"parameters": [
183183
{

elk-traffic-monitor-api/flows/trafficMonitorApi-getinfo.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"nodes": {
3535
"javascript.1": {
3636
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
37-
"name": "Define Index",
37+
"name": "Define GetInfo Index",
3838
"method": "Execute",
3939
"parameters": [
4040
{
@@ -72,7 +72,7 @@
7272
},
7373
"javascript.2": {
7474
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
75-
"name": "Check Params",
75+
"name": "Check GetInfo Params",
7676
"method": "Execute",
7777
"parameters": [
7878
{
@@ -110,7 +110,7 @@
110110
},
111111
"javascript.3": {
112112
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
113-
"name": "Build ES query",
113+
"name": "Build GetInfo ES query",
114114
"method": "Execute",
115115
"parameters": [
116116
{
@@ -149,7 +149,7 @@
149149
},
150150
"elasticsearch.1": {
151151
"type": "nodehandler://@axway-api-builder-ext/api-builder-plugin-fn-elasticsearch/elasticsearch",
152-
"name": "Search Info",
152+
"name": "Search GetInfo",
153153
"method": "search",
154154
"parameters": [
155155
{
@@ -187,7 +187,7 @@
187187
},
188188
"http.2": {
189189
"type": "nodehandler://axway-flow/http",
190-
"name": "Set HTTP 200 Response",
190+
"name": "Response GetInfo",
191191
"method": "setresponse",
192192
"parameters": [
193193
{
@@ -216,7 +216,7 @@
216216
},
217217
"javascript.4": {
218218
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
219-
"name": "Format Response",
219+
"name": "Format GetInfo Response",
220220
"method": "Execute",
221221
"parameters": [
222222
{
@@ -229,7 +229,7 @@
229229
{
230230
"name": "code",
231231
"type": "string",
232-
"value": "\"//init variables\\n \\n let transactionInfo = {};\\n let sourceLegs = [];\\n let resultLegs = [];\\n let legParam = data.params.legID;\\n let detailsParam = data.params.details;\\n let sheadersParam = data.params.sheaders;\\n let rheadersParam = data.params.rheaders;\\n let elasticData = data.elasticsearch.result.body.hits;\\n \\n \\n transactionInfo = elasticData.hits[0]._source;\\n sourceLegs = transactionInfo.transactionElements;\\n \\n // Loop over legs\\n for (var item in sourceLegs) {\\n let sourceLeg = sourceLegs[item];\\n let resultLeg = {};\\n let details = {};\\n\\n\\tlet rheaders = [];\\n let sheaders = [];\\n \\n if (legParam == '*' || legParam == sourceLeg.leg)\\n {\\n \\n if (detailsParam == '1'){\\n details.uri = sourceLeg.protocolInfo.http.uri;\\n details.status = sourceLeg.protocolInfo.http.status;\\n details.statustext = sourceLeg.protocolInfo.http.statusText;\\n details.method = sourceLeg.protocolInfo.http.method;\\n details.vhost = (typeof sourceLeg.protocolInfo.http.vhost === 'undefined') ? null : sourceLeg.protocolInfo.http.vhost; // needs to be checked - not avail in test data\\n details.wafStatus = sourceLeg.protocolInfo.http.wafStatus;\\n details.bytesSent = sourceLeg.protocolInfo.http.bytesSent;\\n details.bytesReceived = sourceLeg.protocolInfo.http.bytesReceived;\\n details.remoteName = sourceLeg.protocolInfo.http.remoteName;\\n details.remoteAddr = sourceLeg.protocolInfo.http.remoteAddr;\\n details.localAddr = sourceLeg.protocolInfo.http.localAddr;\\n details.remotePort = sourceLeg.protocolInfo.http.remotePort;\\n details.localPort = sourceLeg.protocolInfo.http.localPort; \\n details.sslsubject = (typeof sourceLeg.protocolInfo.http.sslSubject === 'undefined') ? null : sourceLeg.protocolInfo.http.sslSubject; //need to be checked - not avail in test data \\n details.leg = sourceLeg.leg;\\n details.timestamp = Date.parse(transactionInfo.timestampOriginal); //Needs to be formatted\\n details.duration = sourceLeg.duration;\\n details.correlationId = transactionInfo.correlationId;\\n details.serviceName = sourceLeg.serviceName;\\n details.subject = sourceLeg.protocolInfo.http.authSubjectId;\\n details.operation = sourceLeg.operation;\\n details.type = 'http'; //ToDo - currently hardcoded. Get it from path param in future\\n details.finalStatus = (typeof sourceLeg.finalStatus === 'undefined') ? null : sourceLeg.finalStatus; //need to be checked - not always avail in test data \\n resultLeg.details = details;\\n } else if (detailsParam == '0'){ \\n resultLeg.details = null;\\n } else{\\n // No details element at all\\n }\\n\\n \\n // Formatting the rHeaders \\n if (rheadersParam == '1'){\\n let rawRecvHeader = [];\\n rawRecvHeader = sourceLeg.protocolInfo.recvHeader.split(\\\"\\\\r\\\\n\\\")\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t;\\n let recvAttributes = []; \\n\\n rawRecvHeader.forEach(function (item,index){\\n if (index !=0){\\n let attribObj = {}; \\n let n = item.indexOf(\\\":\\\");\\n let attribName = item.substr(0,n).toString();\\n let atrribValue = (item.substr(n+1).trim());\\n if (attribName.length != 0) {\\n attribObj[attribName]= atrribValue; \\n recvAttributes.push(attribObj);\\n }\\n }\\n });\\n resultLeg.rheaders = recvAttributes;\\n } else if (rheadersParam == '0'){ \\n resultLeg.rheaders = null;\\n } else {\\n // No rheaders elemenmt at all\\n }\\n\\n\\n // Formatting the sHeaders\\n \\n\\t if (sheadersParam == '1') {\\n let rawSendHeader = [];\\n rawSendHeader = sourceLeg.protocolInfo.sentHeader.split(\\\"\\\\r\\\\n\\\")\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t;\\n let sendAttributes = []; \\n\\n rawSendHeader.forEach(function (item,index){\\n if (index !=0){\\n let attribObj = {}; \\n let n = item.indexOf(\\\":\\\");\\n let attribName = item.substr(0,n).toString();\\n let atrribValue = (item.substr(n+1).trim());\\n if (attribName.length != 0) {\\n attribObj[attribName]= atrribValue; \\n sendAttributes.push(attribObj);\\n }\\n }\\n });\\n\\n resultLeg.sheaders = sendAttributes;\\n } else if (sheadersParam == '0') {\\n resultLeg.sheaders = null;\\n } else {\\n // No sheaders element at all\\n }\\n\\n\\t // Only when all legs are requested create an Array with leg objects.\\n // Otherwise just return the leg object.\\n\\t if (legParam == '*') {\\n \\tresultLegs.push(resultLeg);\\n } else {\\n return resultLeg;\\n }\\n\\n }\\n }\\n\\n \\n return resultLegs;\"",
232+
"value": "\"//init variables\\n \\n let transactionInfo = {};\\n let sourceLegs = [];\\n let resultLegs = [];\\n let legParam = data.params.legID;\\n let detailsParam = data.params.details;\\n let sheadersParam = data.params.sheaders;\\n let rheadersParam = data.params.rheaders;\\n let elasticData = data.elasticsearch.result.body.hits;\\n \\n \\n transactionInfo = elasticData.hits[0]._source;\\n sourceLegs = transactionInfo.transactionElements;\\n \\n // Loop over legs\\n for (var item in sourceLegs) {\\n let sourceLeg = sourceLegs[item];\\n let resultLeg = {};\\n let details = {};\\n\\n\\tlet rheaders = [];\\n let sheaders = [];\\n \\n if (legParam == '*' || legParam == sourceLeg.leg)\\n {\\n \\n if (detailsParam == '1'){\\n details.uri = sourceLeg.protocolInfo.http.uri;\\n details.status = sourceLeg.protocolInfo.http.status;\\n details.statustext = sourceLeg.protocolInfo.http.statusText;\\n details.method = sourceLeg.protocolInfo.http.method;\\n details.vhost = (typeof sourceLeg.protocolInfo.http.vhost === 'undefined') ? null : sourceLeg.protocolInfo.http.vhost; // needs to be checked - not avail in test data\\n details.wafStatus = sourceLeg.protocolInfo.http.wafStatus;\\n details.bytesSent = sourceLeg.protocolInfo.http.bytesSent;\\n details.bytesReceived = sourceLeg.protocolInfo.http.bytesReceived;\\n details.remoteName = sourceLeg.protocolInfo.http.remoteName;\\n details.remoteAddr = sourceLeg.protocolInfo.http.remoteAddr;\\n details.localAddr = sourceLeg.protocolInfo.http.localAddr;\\n details.remotePort = sourceLeg.protocolInfo.http.remotePort;\\n details.localPort = sourceLeg.protocolInfo.http.localPort; \\n details.sslsubject = (typeof sourceLeg.protocolInfo.http.sslSubject === 'undefined') ? null : sourceLeg.protocolInfo.http.sslSubject; //need to be checked - not avail in test data \\n details.leg = sourceLeg.leg;\\n details.timestamp = Date.parse(transactionInfo['@timestamp']); //Needs to be formatted\\n details.duration = sourceLeg.duration;\\n details.correlationId = transactionInfo.correlationId;\\n details.serviceName = sourceLeg.serviceName;\\n details.subject = sourceLeg.protocolInfo.http.authSubjectId;\\n details.operation = sourceLeg.operation;\\n details.type = 'http'; //ToDo - currently hardcoded. Get it from path param in future\\n details.finalStatus = (typeof sourceLeg.finalStatus === 'undefined') ? null : sourceLeg.finalStatus; //need to be checked - not always avail in test data \\n resultLeg.details = details;\\n } else if (detailsParam == '0'){ \\n resultLeg.details = null;\\n } else{\\n // No details element at all\\n }\\n\\n \\n // Formatting the rHeaders \\n if (rheadersParam == '1'){\\n let rawRecvHeader = [];\\n rawRecvHeader = sourceLeg.protocolInfo.recvHeader.split(\\\"\\\\r\\\\n\\\")\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t;\\n let recvAttributes = []; \\n\\n rawRecvHeader.forEach(function (item,index){\\n if (index !=0){\\n let attribObj = {}; \\n let n = item.indexOf(\\\":\\\");\\n let attribName = item.substr(0,n).toString();\\n let atrribValue = (item.substr(n+1).trim());\\n if (attribName.length != 0) {\\n attribObj[attribName]= atrribValue; \\n recvAttributes.push(attribObj);\\n }\\n }\\n });\\n resultLeg.rheaders = recvAttributes;\\n } else if (rheadersParam == '0'){ \\n resultLeg.rheaders = null;\\n } else {\\n // No rheaders elemenmt at all\\n }\\n\\n\\n // Formatting the sHeaders\\n \\n\\t if (sheadersParam == '1') {\\n let rawSendHeader = [];\\n rawSendHeader = sourceLeg.protocolInfo.sentHeader.split(\\\"\\\\r\\\\n\\\")\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t;\\n let sendAttributes = []; \\n\\n rawSendHeader.forEach(function (item,index){\\n if (index !=0){\\n let attribObj = {}; \\n let n = item.indexOf(\\\":\\\");\\n let attribName = item.substr(0,n).toString();\\n let atrribValue = (item.substr(n+1).trim());\\n if (attribName.length != 0) {\\n attribObj[attribName]= atrribValue; \\n sendAttributes.push(attribObj);\\n }\\n }\\n });\\n\\n resultLeg.sheaders = sendAttributes;\\n } else if (sheadersParam == '0') {\\n resultLeg.sheaders = null;\\n } else {\\n // No sheaders element at all\\n }\\n\\n\\t // Only when all legs are requested create an Array with leg objects.\\n // Otherwise just return the leg object.\\n\\t if (legParam == '*') {\\n \\tresultLegs.push(resultLeg);\\n } else {\\n return resultLeg;\\n }\\n\\n }\\n }\\n\\n \\n return resultLegs;\"",
233233
"metaName": "code",
234234
"metaDescription": "A JavaScript function body. Supports `await` and returning promises"
235235
}

elk-traffic-monitor-api/flows/trafficMonitorApi-search.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"nodes": {
3535
"http.1": {
3636
"type": "nodehandler://axway-flow/http",
37-
"name": "Set HTTP Response",
37+
"name": "Set Search response",
3838
"method": "setresponse",
3939
"parameters": [
4040
{
@@ -63,7 +63,7 @@
6363
},
6464
"elasticsearch.1": {
6565
"type": "nodehandler://@axway-api-builder-ext/api-builder-plugin-fn-elasticsearch/elasticsearch",
66-
"name": "Search",
66+
"name": "Query ES for Search",
6767
"method": "search",
6868
"parameters": [
6969
{
@@ -106,7 +106,7 @@
106106
},
107107
"javascript.1": {
108108
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
109-
"name": "Format result",
109+
"name": "Format Search result",
110110
"method": "Execute",
111111
"parameters": [
112112
{
@@ -149,7 +149,7 @@
149149
},
150150
"javascript.2": {
151151
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
152-
"name": "Add All filters",
152+
"name": "Add All search filters",
153153
"method": "Execute",
154154
"parameters": [
155155
{
@@ -300,7 +300,7 @@
300300
},
301301
"javascript.8": {
302302
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
303-
"name": "Define index",
303+
"name": "Define index for search",
304304
"method": "Execute",
305305
"parameters": [
306306
{
@@ -336,7 +336,7 @@
336336
},
337337
"javascript.10": {
338338
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
339-
"name": "Init variables",
339+
"name": "Init search variables",
340340
"method": "Execute",
341341
"parameters": [
342342
{
@@ -372,7 +372,7 @@
372372
},
373373
"javascript.21": {
374374
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
375-
"name": "Handle filter",
375+
"name": "Handle search filter",
376376
"method": "Execute",
377377
"parameters": [
378378
{

elk-traffic-monitor-api/flows/trafficMonitorApi-trace.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"nodes": {
3535
"http.1": {
3636
"type": "nodehandler://axway-flow/http",
37-
"name": "Set HTTP Response",
37+
"name": "Set Trace response",
3838
"method": "setresponse",
3939
"parameters": [
4040
{
@@ -90,7 +90,7 @@
9090
{
9191
"name": "sort",
9292
"type": "string",
93-
"value": "\"@timestamp:desc\"",
93+
"value": "\"@timestamp:asc\"",
9494
"metaName": "sort",
9595
"metaDescription": "A comma-separated list of <field>:<direction> pairs."
9696
}
@@ -115,7 +115,7 @@
115115
},
116116
"javascript.1": {
117117
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
118-
"name": "Format response",
118+
"name": "Format Trace response",
119119
"method": "Execute",
120120
"parameters": [
121121
{
@@ -153,7 +153,7 @@
153153
},
154154
"javascript.2": {
155155
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
156-
"name": "Build ES query",
156+
"name": "Build Trace ES query",
157157
"method": "Execute",
158158
"parameters": [
159159
{
@@ -213,7 +213,7 @@
213213
},
214214
"javascript.3": {
215215
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
216-
"name": "Check Params",
216+
"name": "Check Trace Params",
217217
"method": "Execute",
218218
"parameters": [
219219
{
@@ -280,7 +280,7 @@
280280
},
281281
"javascript.4": {
282282
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
283-
"name": "Define Index",
283+
"name": "Define Trace Index",
284284
"method": "Execute",
285285
"parameters": [
286286
{

logstash/config/traffic_details_index_template.json.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
},
88
"mappings": {
99
"properties": {
10+
"correlationId": {
11+
"type": "keyword"
12+
},
1013
"processInfo.serviceId": {
1114
"type": "keyword"
1215
},

0 commit comments

Comments
 (0)