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
+72-16Lines changed: 72 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,22 @@
1
1
# API-Management Traffic-Monitor based ELK stack
2
2
3
+
This project has 3 main objectives in relation to the Axway API management solution.
4
+
5
+
__Performance__
6
+
3
7
When having many API-Gateway instances with millions of requests the API-Gateway Traffic Monitor can become slow and the observation period quite short. The purpose of this project is to solve that performance issue, make it possible to observe a long time-frame and get other benefits by using a standard external datastore: [Elasticsearch](https://www.elastic.co/elasticsearch).
4
8
9
+
__Visibility__
10
+
11
+
This solution allows API service providers to give access to the Standard Traffic Monitor so that they only see the API traffic of their own organization. This allows API service providers to analyze their own traffic using the extensive information in the traffic monitor.
12
+
13
+
__Analytics__
14
+
15
+
With the help of Kibana, the goal of the project is to deliver standard dashboards that provide analysis capabilities across multiple perspectives.
16
+
It should still be possible to add your own dashboards as you wish.
17
+
18
+
## Architecture
19
+
5
20
The overall architecture this project provides looks like this:
6
21
![Architecture][img1]
7
22
@@ -11,20 +26,35 @@ It also helps, when running the Axway API-Gateway in Docker-Orchestration-Enviro
11
26
Watch this video to see a side by side compare betwen the classical and ElasticSearch based Traffic-Monitor:
Each API-Gateway instance is writing, [if configured](#enable-open-traffic-event-log), Open-Traffic Event-Log-Files, which are streamed by [Filebeat](https://www.elastic.co/beats/filebeat) into a Logstash-Instance. [Logstash](https://www.elastic.co/logstash) performs data pre-processing, combines different events and finally forwards these so called documents into an Elasticsearch cluster.
16
31
17
32
Once the data is indexed by Elasticsearch it can be used by different clients. This process allows almost realtime monitoring of incoming requests. It takes around 5 seconds until a request is available in Elasticsearch.
18
33
19
-
## Using the existing Traffic-Monitor
20
-
Use the existing API-Gateway Traffic-Monitor. That means, you use the same tooling as of today, but the underlying implementation of the Traffic-Monitor API is now pointing to Elasticsearch instead of the internal OPSDB hosted by each API-Gateway instance. This improves performance damatically, as Elasticsearch can scale across multiple machines if required and other dashboards can be created for instance with Kibana.
34
+
## The Traffic-Monitor
35
+
36
+
The standard API-Gateway Traffic-Monitor which is shipped with the solution is based on a REST-API that is provided by the Admin-Node-Manager. By default the Traffic-Information is loaded from the OBSDB running on each API-Gateway instance. This project is partly re-implementing this REST-API, which makes it possible, that the Traffic-Monitor is using data from ElasticSearch instead of the internal OBSDB.
37
+
That means, you can use the same tooling as of today, but the underlying implementation of the Traffic-Monitor is now pointing to Elasticsearch instead of the internal OPSDB hosted by each API-Gateway instance. This improves performance damatically, as Elasticsearch can scale across multiple machines if required and other dashboards can be created for instance with Kibana.
21
38
The glue between Elasticsearch and the API-Gateway Traffic-Monitor is an [API-Builder project](./elk-traffic-monitor-api), that is exposing the same Traffic-Monitor API, but it is implemented using Elasticsearch instead of the OPSDB. The API-Builder is available as a ready to use Docker-Image and preconfigured in the docker-compose file.
22
39
Optionally you can import the API-Builder API into your API-Management system to apply additional security and by that secure access to your Elasticsearch instance.
23
40
24
-
Finally, the Admin-Node-Manager has to be [configured](#configure-the-admin-node-manager) to use the API-Builder API instead of the internal implementation.
In larger companies hundreds of API service providers are using the API Manager to register their own services/APIs and want or should be able to monitor their own API independently. During registration, the corresponding APIs are assigned to API Manager organizations. However, the standard traffic monitor does not know the organization concept and therefore cannot restrict the view for a user based on the organization of an API.
44
+
This project solves the problem by storing the API transactions in Elasticsearch with the appropriate organization. This API organization is used when reading the traffic data from Elasticsearch according to the following rules.
|**Administrator**| N/A | Unrestricted access | A GW-Manager user is considered as an Admin, when is owns the permission: `adminusers_modify`|
49
+
|**Operator**| API-Admin | All APIs having a Service-Context | By default each API processed by the API-Manager has a Service-Context. Pure Gateway APIs (e.g. /healthcheck) will not be visible.|
50
+
|**Operator**| Org-Admin | APIs of its own organization | Such a user will only see the APIs that belong to the same organization as himself. |
51
+
|**Operator**| User | APIs of its own organization | The same rules apply as for the Org-Admin |
52
+
53
+
### Setup Restricted user
54
+
55
+
To give a user limited access to the API Traffic Monitor, the user must use the same login name in the API Manager and API Gateway Manager. Here, for example, an LDAP connection can be a simplification.
56
+
In order to give the user a restricted view in the API Gateway Manager, none of his roles must contain the permission: `adminusers_modify`. A suitable standard role is the `API Gateway Operator role`.
57
+
You can, of course, create additional roles in the API Gateway Manager to adjust the user's rights according to your needs.
28
58
29
59
## Prerequisites
30
60
For a simple deployment the prerequisites are very simple as all services can be started as a Docker-Container. In order to start all components in PoC-Like-Mode you just need:
@@ -81,31 +111,54 @@ You may add a custom success message (e.g. `Used ElasticSearch API`) if you like
81
111
:point_right:
82
112
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`). Afterwards the ANM must be restarted.
83
113
114
+
## Setup
115
+
116
+
Before you start the environment based on the `docker-compose.yml` file, please adjust the `.env` file accordingly. The configuration is already used by the different modules as described below.
117
+
84
118
### Setup filebeat
85
119
:exclamation:__This is an important step, as otherwise Filebeat will not see and send any Open-Traffic Event data!__
86
-
Before starting the container using docker-compose, make sure to setup the paths in the project `*.env` file. The variables must point to your running API-Gateway instance. These parameters are used to mount the Open-Traffic-Folder into the Filebeat container. For a typical Linux installation it looks like this (APIM beeing a symlink to current software version):
120
+
Setup the paths in the project `*.env` file. The variables must point to your running API-Gateway instance. These parameters are used to mount the Open-Traffic-Folder into the Filebeat container. For a typical Linux installation it looks like this (APIM being a symlink to current software version):
Logstash receives the open traffic and open trace events from Filebeat and processes them. Among other things, an HTTP lookup is performed on an API detail lookup REST-API to enrich the API information. Therefore Logstash must know under which URL the API builder can be reached.
129
+
This parameter is optional if you use the default docker-compose.yml file.
130
+
```
131
+
API_BUILDER_URL=http://my-api-builder:8080
132
+
```
133
+
92
134
### Setup API-Builder
93
-
As the API-Builder container needs to communicate with Elasticsearch it needs to know where Elasticsearch is running. Again, this environment variable must be configured within `.env`:
135
+
As the API-Builder container needs to communicate with Elasticsearch it needs to know where Elasticsearch is running:
136
+
Please note, when using the default docker-compose.yaml the default setting is sufficient, as it's using the internal Docker-Network `elastic`.
94
137
```
95
138
ELASTIC_NODE=http://elasticsearch1:9200
96
139
```
97
-
Please note, when using the default docker-compose.yaml the default setting is sufficient, as it's using the internal Docker-Network `elastic`.
98
-
99
-
### Update vm.max_map_count kernel setting to at least 262144
140
+
Furthermore, the API Builder communicates with the Admin Node Manager and API Manager. Therefore the following parameters must be configured in the `.env` file.
141
+
```
142
+
ADMIN_NODE_MANAGER=https://api-env:8090
143
+
API_MANAGER_USERNAME=<admin-user>
144
+
API_MANAGER_PASSWORD=<admin-password>
145
+
```
100
146
101
-
See https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-prod-prerequisites
To bring up the entire environment using docker-compose:
105
152
````
106
153
docker-compose up -d
107
154
````
108
-
Of course, the components can also run on different machines or on a Docker-Orchestration framework such as Kubernetes.
155
+
You can also run the individual components on different environments. To do this, you can check out the project on the appropriate machines, adjust the docker-compose.yml and .env file and start the desired services.
156
+
To start a single service (e.g. the API-Builder project):
157
+
```
158
+
docker-compose up -d elk-traffic-monitor-api
159
+
```
160
+
161
+
Of course it is also possible to run the containers in a docker orchestration framework, like Kubernetes or OpenShift.
109
162
110
163
### Stop local Elasticsearch cluster
111
164
````
@@ -179,7 +232,10 @@ When Logstash is successfully started you should see the following:
[INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
181
234
```
182
-
235
+
If you see the following or similar error message during processing of events the API-Builder Lookup-API cannot be reached. In case, please make sure the environment variable: `API_BUILDER_URL`is set correctly.
236
+
```
237
+
[2020-08-19T10:51:05,671][ERROR][logstash.filters.http ][main][......] error during HTTP request {:url=>"/api/elk/v1/api/lookup/api", :body=>nil, :client_error=>"Target host is not specified"}
238
+
```
183
239
184
240
### Check Elasticsearch processing
185
241
It takes a while until Elasticsearch is finally started and reports it with the following line:
Flow-nodes are used within [Axway API Builder's](https://www.axway.com/en/datasheet/axway-api-builder)
6
+
flow editor that is a low-code / no-code solution to designing and developing services
7
+
that integrate to many different connected components, such as databases and APIs.
8
+
9
+
## Getting started
10
+
11
+
1. Follow the [Getting Started Guide](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_getting_started_guide.html) to create an API Builder service
12
+
1. Follow the [API Builder SDK](https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/api_builder_sdk.html) guide to get started creating flow-node plugins.
13
+
14
+
## Publish
15
+
16
+
After developing this plugin you can publish it to [npm](https://www.npmjs.com) to make it public.
17
+
18
+
## Install
19
+
20
+
After creating your API Builder service (`api-builder init`), you can install this plugin using npm:
0 commit comments