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

Commit d842937

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 05a808e + 83a04c1 commit d842937

File tree

8 files changed

+1073
-306
lines changed

8 files changed

+1073
-306
lines changed

.github/workflows/traffic-monitor-api.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ jobs:
3333
uses: nyaruka/elasticsearch-action@v1
3434
with:
3535
elastic version: '7.6.1'
36-
- name: Sleep 30 seconds to make sure ES is ready
36+
- name: Sleep 15 seconds to make sure ES is ready
3737
uses: jakejarvis/wait-action@master
3838
with:
39-
time: '30s'
39+
time: '15s'
4040
- name: Run npm ci, npm test
4141
working-directory: ${{env.workingDirectory}}
4242
env:

README.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,38 +62,40 @@ To run the components in a PoC-Like mode, the recommended way is to clone this p
6262
This creates a local copy of the repository and you can start from there.
6363

6464
### Enable Open-Traffic Event Log
65-
Obviously you have to enable Open-Traffic-Event log for your API-Gateway instances. [Read here][1] how to enable the Open-Traffic Event-Log.
66-
After this configuration has been done, Open-Traffic log-files will created by default in this location: `apigateway/logs/opentraffic`. This location becomes relevant when configuring Filebeat.
65+
Obviously, you have to enable Open-Traffic-Event log for your API-Gateway instance(s). [Read here][1] how to enable the Open-Traffic Event-Log.
66+
After this configuration has been done, Open-Traffic log-files will be created by default in this location: `apigateway/logs/opentraffic`. This location becomes relevant when configuring Filebeat.
6767

6868
### Configure the Admin-Node-Manager
69-
This step is required if you would like to use the existing API-Gateway Manager Traffic-Monitor in combination with Elasticsearch.
70-
The Admin-Node-Manager (listening by default on port 8090) is responsible to serve the Traffic-Monitor and needs to be configured to use the API-Builder REST-API instead.
71-
For the following steps, please open the Admin-Node-Manager configuration in Policy-Studio. You can read [here](https://docs.axway.com/bundle/axway-open-docs/page/docs/apim_administration/apigtw_admin/general_rbac_ad_ldap/index.html#use-the-ldap-policy-to-protect-management-services) how to do that.
72-
- Create a new policy called: `Use Elasticsearch API`
73-
- Configure this policy like so:
69+
As the idea of this project is to use the existing API-Gateway Manager UI (short: ANM) to render log data now provided by Elasticsearch instead of the individual API-Gateway instances before (the build in behavior), it is required to patch the ANM configuration to make use of Elasticsearch instead of the API-Gateway instances (default setup). By default, ANM is listening on port 8090 for administrative traffic. This API is responsible to serve the Traffic-Monitor and needs to be configured to use the API-Builder REST-API instead.
70+
71+
For the following steps, please open the ANM configuration in Policy-Studio. You can read [here](https://docs.axway.com/bundle/axway-open-docs/page/docs/apim_administration/apigtw_admin/general_rbac_ad_ldap/index.html#use-the-ldap-policy-to-protect-management-services) how to do that.
72+
- Create a new policy and name it `Use Elasticsearch API` - *This Policy will decide on what API calls can be routed to Elasticsearch*
73+
- The configured Policy should look like this:
74+
7475
![use ES API][img3]
75-
- The `Compare Attribute` filter checks if the requested API is already handled by the API-Builder project.
76-
_As of today, only the Traffic-Overview is handled by the API-Builder. This will be changed soon._
77-
- Add the following: `http.request.path` is `/api/router/service/instance-1/ops/search`
78-
_The list of requests will be extended once the API-Builder project can serve more (e.g. the Request-Detail view)_
79-
![Is API Managed][img6]
80-
- Adjust the URL of the Connect to URL filter to your running API-Builder docker container and port (default is 8889).
81-
![Connect to ES API][img7]
82-
- Insert the created policy as a callback policy into the main policy: `Protect Management Interfaces` like so:
76+
77+
- The `Compare Attribute` filter checks if the requested API can be handled by the API-Builder project.
78+
_Right now, only the Traffic-Overview is implemented and can be handled by the API-Builder glue project. This will be extended soon!_
79+
- Add a criterion: `http.request.path` is `/api/router/service/instance-1/ops/search`
80+
_The list of requests will be extended once the API-Builder project can serve more (e.g. the Request-Detail view). Right now, this is just hard coded for the topology we used for testing!_
81+
![Is API Managed][img6]
82+
- 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}`
83+
![Connect to ES API][img7]
84+
- Insert the created policy as a callback policy (filter: Shortcut filter) into the main policy: `Protect Management Interfaces` and wire it like shown here:
8385
![Use Callback][img4]
8486

85-
After you have saved back the configuration to the Admin-Node-Manager and restarted it, the Admin-Node-Manager will use the API-Builder API (Elasticsearch) to serve the specified request-types.
87+
After you have saved, copy the configuration files from your local *Policy Studio* project (path on Linux: `/home/<user>/apiprojects/\<project-name\>`) back the configuration to the Admin-Node-Manager configuration (`\<install-dir\>/apigateway/conf/fed`) and restarted it. The Admin-Node-Manager will use the API provided by API-Builder to query the Elasticsearch API to serve the specified request-types.
8688

8789
### Setup filebeat
8890
:exclamation: __This is an important step, as otherwise Filebeat will not see and send any Open-Traffic Event data!__
89-
Before starting the container using docker-compose, make sure to setup the paths in the .env file to your running API-Gateway instance. This configuration is used to mount the Open-Traffic-Folder into Filebeat container.
91+
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):
9092
```
91-
APIGATEWAY_LOGS_FOLDER=/home/localuser/Axway-x.y.z/apigateway/logs/opentraffic
92-
APIGATEWAY_TRACES_FOLDER=/home/localuser/Axway-x.y.z/apigateway/groups/group-1/instance-1/trace
93+
APIGATEWAY_LOGS_FOLDER=/opt/Axway/APIM/apigateway/logs/opentraffic
94+
APIGATEWAY_TRACES_FOLDER=/opt/Axway/APIM/apigateway/groups/group-2/instance-1/trace
9395
```
9496

9597
### Setup API-Builder
96-
As the API-Builder container needs to communicate with Elasticsearch it needs to know where Elasticsearch is running. Use this environment variable to configure it:
98+
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`:
9799
```
98100
ELASTIC_NODE=http://elasticsearch1:9200
99101
```
@@ -103,25 +105,27 @@ Please note, when using the default docker-compose.yaml the default setting is s
103105

104106
See https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-prod-prerequisites
105107

106-
### Start local elasticsearch cluster
108+
### Start local Elasticsearch cluster
107109
Bring the cluster up using docker-compose:
108110
````
109111
docker-compose up -d
110112
````
111113
Of course, the components can also run on different machines or on a Docker-Orchestration framework such as Kubernetes.
112114

113-
### Stop cluster
115+
### Stop local Elasticsearch cluster
114116
````
115117
docker-compose down
116118
````
117119

118-
### Import API-Builder Traffic-Monitor API
119-
To secure access to your Elasticsearch instance you can import the API Builder REST-API into your API-Manager. You can access the Swagger/OpenAPI definition here:
120+
### Securing API-Builder Traffic-Monitor API
121+
The API-Builder project for providing access to Elasticsearch data has no access restrictions right now. To ensure only API-Gateway Manager users (topology administrators with proper RBAC role) or other users with appropriate access rights can query the log data, one can expose this API via API-Manager and add security here.
122+
123+
To import the API Builder project REST-API into your API-Manager, you can access the Swagger/OpenAPI definition here (replace docker-host and port appropriately for the container that is hosting the API-Builder project):
120124
http://docker-host:8889/apidoc/swagger.json?endpoints/trafficMonitorApi
121125

122126
## Troubleshooting
123127
### Check processes/containers are running
124-
From within the folder where the docker-compose.yml file is located execute:
128+
From within the folder where the docker-compose.yml file is located (git project folder) execute:
125129
```
126130
docker-compose inspect
127131
Name Command State Ports

0 commit comments

Comments
 (0)