Collect Access Logs


This guide provides instructions on how to collect logs using the Volterra API. Volterra provides API support to fetch various types of logs so that you can analyze and obtain insights during troubleshooting or process the logs further to feed to your monitoring systems. For more information on Volterra APIs, see API Documentation.

Using the instructions provided in this guide, you can collect logs using the Volterra API and also learn how to process the logs further according to your requirements.


Collect Access Logs

The example in this guide shows how to collect various access logs using the access_logs API. This example also includes a sample script that collects the logs within a specific time interval.

Step 1: Download the API credentials. Log into the VoltConsole. Select IAM from the configuration menu and API Credentials from the options. Click Create credentials to download the credentials in the p12 format.

Step 2: Enter the API request using a client to get the logs. This example shows curl to get the logs.

curl -v -k --cert-type P12 --cert /<path-to-your-api-creds>.p12:<api-password> -X POST https://<tenant><namespace>/access_logs

Note: The <path-to-your-api-creds> is the full path to the downloaded API credentials file and <api-password> is the password you set for the credentials file. The <namespace> is the name of your namespace <tenant> is the name of your tenant.

Step 3: You can also execute a POST request specifying the time interval in which you want to collect the logs for a specific virtual host.

curl -v -k --cert-type P12 --cert ~/<path-to-your-api-creds>.p12:volterra -X POST https://<tenant><namespace>/access_logs --data-binary '{"query":"{vh_name=\"<vhostname>\"}","namespace":"<namespace>","start_time":"2020-03-21T15:43:00.000Z","end_time":"2020-03-21T16:43:00.000Z"}' --compressed

Collect Logs Using a Script

Step 1: Download the sample Script to collect access logs.

Step 2: Set the following environment variables.

export NAMESPACE=<the Volterra NAMESPACE containing logs>
export DOMAIN=<the Volterra tenant URL https://$>
export VH_NAME=<the virtual host to gather logs from >
export P12_FILE=<the path to your p12 file >
export VES_P12_PASSWORD=<the password to your p12 file >

Step 3: Execute the script.


Step 4: The access logs for the past 24 hours get stored under a JSON file beginning with a timestamp in the $TIMESTAMP-accesslogs.json format.