How to log data to InfluxDB
Prepare an InfluxDB server, connect the InfluxDB v2 Historian to it, and check that tag values arrive. The steps use InfluxDB Cloud, the typical cloud setup, and apply to a self-hosted InfluxDB v2 server with the changes noted. The InfluxDB v1 Logger and the InfluxDB v3 Historian use different connection settings, which InfluxDB v1 Logger and InfluxDB historians describe.
Before you start, you need:
- An active profile and the Modify components permission.
- The Historians licensed feature, which the Desktop, Server, and Enterprise editions include.
- An InfluxDB server whose version you know, because InfluxDB V1, V2, and V3 are separate, incompatible products and Profinity has a component for each.
- Network access from the Profinity machine to the InfluxDB server.
- At least one tag collection that holds the tags to log.
Prepare InfluxDB
To use InfluxDB Cloud:
- Sign up for InfluxDB Cloud and create an organisation.
- Create a bucket for your data.
- Generate an API token with write permission.
- Note the organisation name, bucket name, API token, and the InfluxDB URL shown in your account.
To use a self-hosted InfluxDB:
- Install and start InfluxDB on your server.
-
Create a bucket and an API token, for example:
Connect the InfluxDB v2 Historian
- Add the InfluxDB v2 Historian under Historians, as described in How to add a component to your profile.
- Enter the Influx Server URL.
For InfluxDB Cloud, use the URL shown in your account, such as
https://us-east-1-1.aws.cloud2.influxdata.com. For a self-hosted server, usehttp://<your-server>:8086. - Enter the InfluxDB Organisation, InfluxDB Bucket, and InfluxDB Token.
- For InfluxDB Cloud, set InfluxDB Health Check to false, because InfluxDB Cloud does not support the health check API.
- In Collections, add a row for each tag collection to log and select the collection in that row. The historian starts only when at least one collection is configured.
- Optional: set the Update Interval (Seconds) and the Logging mode. Logging modes describes what each mode sends.
- Select ADD COMPONENT at the bottom of the dialog.
Replace <your-server> with the host name or address of your InfluxDB server.
The historian starts when the profile loads if Auto Connect is on, and Connections and reconnecting lists each component's default.
Check that data is arriving
- Check that the historian component shows no connection error.
- In the InfluxDB web interface, open Data Explorer.
-
Run this query, replacing
my-profinity-datawith your bucket andYour_Profile_Namewith your profile name, with spaces and other punctuation replaced by underscores:
The query returns points when data is arriving. If it returns nothing, refer to If data does not arrive. For what Profinity writes for each tag and how to query it, refer to What is stored. To send the same collections to another destination, refer to How to configure data logging.