In this guide we will use Airbotics to set up ROS logging.

Goals

  • Configure log collection.
  • Query log messages.
  • Understand buffering.
  • Delete logs.

Prerequisites

  • An account with Airbotics.
  • A valid API key with the logs:read and logs:write permissions.
  • Device running Ubuntu 22.04 with ROS 2 and the airbotics agent installed.
  • Physical or SSH access to your device.

Prepare environment

Ensure you have the following two environment variables set before you get started:

export AIR_API_KEY=<your_api_key>
export AIR_ROBOT_ID=<your_robot_id>

Run the agent

airbotics

Configure log collection

By default logging is not enabled when you provision a new robot. Any ROS logs will be ignored by the agent until they are enabled. You can enable logging with the following API call:

curl --request PATCH https://api.airbotics.io/robots/$AIR_ROBOT_ID/logs/config \
    --header "content-type: application/json" \
    --header "air-api-key: $AIR_API_KEY" \
    --data '{
        "enabled": true
    }'

Query log message

After enabling, you can query log messages with the following API call:

curl --request GET https://api.airbotics.io/robots/$AIR_ROBOT_ID/logs?limit=20 \
    --header "content-type: application/json" \
    --header "air-api-key: $AIR_API_KEY" 

We are fetching only the latest 20 messages here.

Understand buffering

Buffering is a separate built in mechanism that aims to reduce dropped logs. When the agent losses network connection it will store a buffer of up to 65555 logs. On reconnection it will start sending all of the buffered logs. In the case where the buffer overflows, i.e more than 65555 log messages are received before the connection is re-established, oldest logs start to be dropped by newer logs in a FIFO process.

If you have a strict requirement for 0 dropped logs, we suggest using a ROS bag in this situation.

Wrapping up

In this deep dive you have configured and collected logs.

Cleaning up

If you want to delete all collected logs you can make the following API call:

curl --request DELETE https://api.airbotics.io/robots/$AIR_ROBOT_ID/logs \
    --header "content-type: application/json" \
    --header "air-api-key: $AIR_API_KEY"