Deleting Data from InfluxDB





In this guide, we'll go through the steps to delete specific data points from your InfluxDB bucket using the influx delete command. This process will allow you to remove data for a particular measurement from your InfluxDB database. In case you have not installed InfluxDB yet, click here .


Steps to Delete Data

1. Adapt the Command

Before executing the deletion command, you need to adapt it to your specific bucket, organization, predicate, and token. Below is a template command you will need to modify:


influx delete \
  --bucket 'gateway_bucket' \
  --org 'purdue_gatewaylabs' \
  --start '1970-01-01T00:00:00Z' \
  --stop "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
  --predicate '_measurement="Acra/ATL-618EVS_Test"' \
  --token 'H7oLnzGHOJ7c2xfpctH0k7UaYn-JSy0o9-QaBZO4D_CKgS5PX6Mcv2G-E52YxghIExw2rPSp019ZzAn73iBX8g=='
      

2. Execute the Command

Access the InfluxDB Docker Container

  • Open your Docker environment.

  • Select the InfluxDB container you are running.

  • Go to the Exec tab to access the command line interface of the container.

Run the Command

  • Paste the adapted influx delete command into the Exec tab's command-line interface.

  • Hit Enter to execute the command.

The command described earlier being ran inside the command-line interface of the docker container.

Command Explanation

  • influx delete: The command to delete data points from InfluxDB.

  • --bucket 'gateway_bucket': Specifies the bucket from which data will be deleted.

  • --org 'purdue_gatewaylabs': Specifies the organization associated with the bucket.

  • --start '1970-01-01T00:00:00Z': The start time for the deletion range (from the beginning of time).

  • --stop "$(date -u +"%Y-%m-%dT%H:%M:%SZ")": The stop time for the deletion range (up to the current time).

  • --predicate '_measurement="Acra/ALT-618EVS_Test"': Specifies the condition for the deletion (deletes only data points with this measurement name).

  • --token 'H7oLnzGHOJ7c2xfpctH0k7UaYn-JSy0o9-QaBZO4D_CKgS5PX6Mcv2G-E52YxghIExw2rPSp019ZzAn73iBX8g==': The authentication token for accessing the InfluxDB API.

Important Notes

Ensure Accuracy:

Make sure to double-check the bucket, organization, and predicate values to ensure you are deleting the correct data.

Date Range:

Adjust the date range (start and stop parameters) as needed to target specific data points.

By following these steps, you can successfully delete specific data points from your InfluxDB bucket and keep your database remains clean and organized.