You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 14, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,10 +76,11 @@ For the following steps, please open the ANM configuration in Policy-Studio. You
76
76
77
77
- The `Compare Attribute` filter checks if the requested API can be handled by the API-Builder project.
78
78
As a basis for decision-making a criteria for each endpoint needs to be added to the filter configuration.
79
-
_At this point in time only two endpoints are supported by the API Builder based Traffic-Monitor API.
80
-
The **search** endpoint which provides the data for the HTTP Traffic overview and the **circuitpath** endpoint which provides the data for the Filter Execution Path as part of the detailed view of a transaction. Currently the API Builder Project does not cover all endpoints to completely replace the existing Traffic Monitor API yet, but more endpoints will be added soon!_
79
+
_At this point in time three endpoints are supported by the API Builder based Traffic-Monitor API.
80
+
The **search** endpoint which provides the data for the HTTP Traffic overview, the **circuitpath** endpoint which provides the data for the Filter Execution Path as part of the detailed view of a transaction and the **trace** endpoint which returns the trace information. Currently the API Builder Project does not cover all endpoints to completely replace the existing Traffic Monitor API yet, but more endpoints will be added soon!_
81
81
For search endpoint add: `http.request.path`matches regular expression `^\/api\/router\/service\/[A-Za-z0-9-.]+\/ops\/search$`
82
82
For circuitpath endpoint add: `http.request.path`matches regular expression `^\/api\/router\/service\/[A-Za-z0-9-.]+\/ops\/stream\/[A-Za-z0-9]+\/[^\/]+\/circuitpath$`
83
+
For trace endpoint add: `http.request.path`matches regular expression `^\/api\/router\/service\/[A-Za-z0-9-.]+\/ops\/trace\/[A-Za-z0-9]+[\?]?.*$`
83
84
_The list of requests will be extended once the API-Builder project can serve more (e.g. the Request-Detail view)._
84
85
![Is API Managed][img6]
85
86
- Adjust the URL of the Connect to URL filter to your running API-Builder docker container and port - **default is 8889**. Sample: `http://api-env:8889/api/elk/v1${http.request.rawURI}`
"metaDescription": "Defines the search definition using the Query DSL. Learn more: https://www.elastic.co/guide/en/elasticsearch/reference/7.x/query-dsl.html"
75
+
},
76
+
{
77
+
"name": "size",
78
+
"type": "number",
79
+
"value": "10000",
80
+
"metaName": "size",
81
+
"metaDescription": "Defines the number of hits to return. Defaults to 10."
82
+
},
83
+
{
84
+
"name": "index",
85
+
"type": "jsonpath",
86
+
"value": "$.index",
87
+
"metaName": "index",
88
+
"metaDescription": "Comma-separated list or wildcard expression of index names used to limit the request."
"metaDescription": "The value to apply as the `data` argument to the JavaScript code. For objects and arrays, `data` is passed by reference."
120
+
},
121
+
{
122
+
"name": "code",
123
+
"type": "string",
124
+
"value": "\"let result = [];\\n \\n data.hits.map(function(entry) {\\n let traceObj = {};\\n let message = entry._source.message;\\n let dateObj = isoStringToDate(entry._source.timestampOriginal);\\n let dateObj2 = parseDate(entry._source.timestampOriginal);\\n\\t\\n // depth is the number of tabs befor start of the message. \\n // Calculated based on count of white spaces divided by 4\\n const depthRegex = /(?<=[\\\\]])\\\\s*/gm;\\n let depthMatch = depthRegex.exec(message);\\n\\tlet depth = 1;\\n \\n if (depthMatch !== null){\\n depth = Math.round(depthMatch[0].length/4);\\n }\\n \\n traceObj.level = entry._source.level;\\n traceObj.type = 'trace';\\n traceObj.time = dateObj.getTime();\\n traceObj.depth = depth;\\n traceObj.text = message.substring(message.lastIndexOf(\\\"]\\\")+1,message.length).trim();\\n \\n result.push(traceObj);\\n \\n });\\n\\n \\nfunction parseDate(input) {\\n var parts = input.match(/(\\\\d+)/g);\\n // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])\\n return new Date(parts[0], parts[1]-1, parts[2]); // months are 0-based\\n}\\n\\n // Parse an ISO date string (i.e. \\\"2019-01-18T00:00:00.000Z\\\",\\n// \\\"2019-01-17T17:00:00.000-07:00\\\", or \\\"2019-01-18T07:00:00.000+07:00\\\",\\n// which are the same time) and return a JavaScript Date object with the\\n// value represented by the string.\\nfunction isoStringToDate( isoString ) {\\n\\n // Split the string into an array based on the digit groups.\\n var dateParts = isoString.split( /\\\\D+/ );\\n\\n // Set up a date object with the current time.\\n var returnDate = new Date();\\n\\n // Manually parse the parts of the string and set each part for the\\n // date. Note: Using the UTC versions of these functions is necessary\\n // because we're manually adjusting for time zones stored in the\\n // string.\\n returnDate.setUTCFullYear( parseInt( dateParts[ 0 ] ) );\\n\\n // The month numbers are one \\\"off\\\" from what normal humans would expect\\n // because January == 0.\\n returnDate.setUTCMonth( parseInt( dateParts[ 1 ] - 1 ) );\\n returnDate.setUTCDate( parseInt( dateParts[ 2 ] ) );\\n\\n // Set the time parts of the date object.\\n returnDate.setUTCHours( parseInt( dateParts[ 3 ] ) );\\n returnDate.setUTCMinutes( parseInt( dateParts[ 4 ] ) );\\n returnDate.setUTCSeconds( parseInt( dateParts[ 5 ] ) );\\n returnDate.setUTCMilliseconds( parseInt( dateParts[ 6 ] ) );\\n\\n // Track the number of hours we need to adjust the date by based\\n // on the timezone.\\n var timezoneOffsetHours = 0;\\n\\n // If there's a value for either the hours or minutes offset.\\n if ( dateParts[ 7 ] || dateParts[ 8 ] ) {\\n\\n // Track the number of minutes we need to adjust the date by\\n // based on the timezone.\\n var timezoneOffsetMinutes = 0;\\n\\n // If there's a value for the minutes offset.\\n if ( dateParts[ 8 ] ) {\\n\\n // Convert the minutes value into an hours value.\\n timezoneOffsetMinutes = parseInt( dateParts[ 8 ] ) / 60;\\n }\\n\\n // Add the hours and minutes values to get the total offset in\\n // hours.\\n timezoneOffsetHours = parseInt( dateParts[ 7 ] ) + timezoneOffsetMinutes;\\n\\n // If the sign for the timezone is a plus to indicate the\\n // timezone is ahead of UTC time.\\n if ( isoString.substr( -6, 1 ) == \\\"+\\\" ) {\\n\\n // Make the offset negative since the hours will need to be\\n // subtracted from the date.\\n timezoneOffsetHours *= -1;\\n }\\n }\\n\\n // Get the current hours for the date and add the offset to get the\\n // correct time adjusted for timezone.\\n returnDate.setHours( returnDate.getHours() + timezoneOffsetHours );\\n\\n // Return the Date object calculated from the string.\\n return returnDate;\\n}\\n \\n return result;\"",
125
+
"metaName": "code",
126
+
"metaDescription": "A JavaScript function body. Supports `await` and returning promises"
0 commit comments