Troubleshooting

The Akita CLI will show an error if the collection of API traffic fails or results in an empty trace. Possible causes include:

  • Non-root users do not have the permissions to capture network traffic. You will see the message You don't have permission to capture on that device if that is the case. Try running as root, or with sudo.
  • The API traffic you are attempting to capture runs over HTTPS, instead of HTTP. In this case the API will give the error No inbound HTTP calls captured, as well as report the number of packets captured with Captured %d TCP packets total; %d unparsed TCP segments. This indicates that some network traffic was detected, but could not be successfully parsed.
  • The TCP port number you gave was incorrect, so the traffic was not included in the trace. This case will also report an error No inbound HTTP calls captured, but additionally show the explanatory message Did not capture any TCP packets matching the filter or Did not capture any TCP packets during the trace,

See the Diagnostics section in the apidump command for more information.

Test That Akita Saw All Your Endpoints

Once you run Akita, here’s how you can test that your setup worked. First, use apidump to capture traffic to your service and store it in a local trace.

# 1. Start capturing traffic:
akita apidump --filter "port ${YOUR_PORT}" --out path/to/local/dir

# 2. Exercise your service's API.
# 3. Hit Ctrl+C to stop capturing traffic.
# 1. Start capturing traffic:
akita apidump --filter "port ${YOUR_PORT}" --out path/to/local/dir

# 2. Exercise your service's API.
# 3. Hit Ctrl+C to stop capturing traffic.
# 0. Find your Akita API key, secret, the name of the docker container
#    your service is in, and the port it listens on.  Use these values
#    in the next step.
#
#    Also set the HAR_OUTPUT_DIR environment variable (or replace it in
#    the --volume flag) to specify a directory to store the output.

# 1. Start capturing traffic:
docker run --rm -it \
  --env AKITA_API_KEY_ID=${KEY_ID} \
  --env AKITA_API_KEY_SECRET=${KEY_SECRET} \
  --net="container:${CONTAINER_NAME}" \
  --volume ${HAR_OUTPUT_DIR}:/har \
  akitasoftware/cli:<<current_cli_version>> apidump \
  --filter "port ${YOUR_PORT}" \
  --out /har

# 2. Exercise your service's API.
# 3. Hit Ctrl+C to stop capturing traffic.

📘

Getting HAR Files From Docker

If you run apidump in Docker, then you'll need to mount a volume in order to access the HAR files outside of Docker.

The Docker command above includes the flag --volume ${HAR_OUTPUT_DIR}:/har, which ensures that any files written to /har in the container are accessible at the directory you supply with ${HAR_OUTPUT_DIR} outside the container. Combined with the --out /har flag, this ensures that the HAR files will be accessible from the local file system.

Traces are formatted as HAR files, which use a JSON encoding to represent traffic. If you install the jq utility, you can use the following command to list the endpoints in the HAR files.

# Echo unique raw endpoints observed:
for har in path/to/local/dir/*.har; do
  cat ${har} | jq '.log.entries | .[] | .request.url' | sort | uniq
done

You can also print the contents of each request, rather than just the endpoint. Additional information can often be found in the request headers, like the host and port receiving the request.

# Echo requests observed:
for har in path/to/local/dir/*.har; do
  cat ${har} | jq '.log.entries | .[] | .request'
done

What If I Don't Have Server Traffic?

We recommend trying Akita out with your own server, but here are some alternatives in case that is not available to you right now.

Other Troubleshooting Questions


Did this page help you?