Skip to content

fastly/compute-js-apiclarity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Integrate sampled Fastly Next-Gen WAF logs with APIClarity

Extract data from the NGWAF logs and send that request and response data to locally running APIClarity to document you API.

https://docs.fastly.com/en/ngwaf/extract-your-data

https://github.com/openclarity/apiclarity

Pre-reqs

Quickstart

Make sure you have installed the necessary software in the pre-reqs.

Build APIClarity and start a locally running Fastly Compute environment

Run npm i to install necessary packages. Then just run make build

Capture the APIClarity token and send a request to the Fastly Compute environment.

make demo The request to Fastly Compute environment will do the following.

  • Query for a period of times worth of NGWAF Sampled logs
  • Format that returned data for APIClarity
  • Send the formatted data to APIClarity

Access the APIClarity UI

Navigate to the URL at the end of the output from the previous make demo command to access the APIClarity UI. You will be able to generate an OpenAPI spec from APIClarity UI.

Capture the APIClarity Trace Source Token

TRACE_SOURCE_TOKEN=$(curl --http1.1 --insecure -s -H 'Content-Type: application/json' -d '{"name":"apigee_gateway","type":"APIGEE_X"}' https://localhost:8443/api/control/traceSources|jq -r '.token')

You may use curl or http to send the request to the locally running Fastly compute instance formatted like the following.

http http://127.0.0.1:7676/get_sampled_logs NGWAF_EMAIL=$NGWAF_EMAIL NGWAF_TOKEN=$NGWAF_TOKEN corpName=$NGWAF_CORP siteName=$NGWAF_SITE TRACE-SOURCE-TOKEN=$TRACE_SOURCE_TOKEN -p=b

Releases

No releases published

Packages

No packages published