Configure the OPC Classic extractor
To configure the OPC Classic extractor, you must edit the configuration file. The file is in YAML format and the sample configuration file contains all valid options with default values.
When setting up an extractor, you should not base your config on the file config.example.yml
, but instead, use the config.minimal.yml
as your base and copy the parts you need from config.example.yml
.
You can exclude fields entirely to let the extractor use default values. The configuration file separates settings by component, and you can remove an entire component to disable it or use default values.
Environment variable substitution
In the config file, values wrapped in ${}
are replaced with environment variables with that name. For example, ${COGNITE_PROJECT}
will be replaced with the value of the environment variable called COGNITE_PROJECT
.
The configuration file also contains the global parameter version
, which holds the version of the configuration schema used in the configuration file. This document describes version 1 of the configuration schema.
You can set up extraction pipelines to use versioned extractor configuration files stored in the cloud.
Minimal YAML configuration file
version: 1
source:
# Windows username for authentication
username:
# Windows password for authentication
password:
# List of servers to connect to.
servers:
- # Server host name or IP address
host:
# Version of DA to use, one of V2 or V3
# This can be left out to disable live data.
da-version:
# Version of HDA to connect to on this host.
# This can be left out to disable history.
# Must be V1
hda-version:
# Prefix on externalIds for nodes generated by this server.
id-prefix:
# Name of state store used to store states if history is enabled for this server. Required if hda-version is set.
state-store-name:
endpoint-url: "opc.tcp://localhost:4840"
cognite:
# The project to connect to in the API, uses the environment variable COGNITE_PROJECT.
project: "${COGNITE_PROJECT}"
# If this is set to true, credentials can be left out, and the extractor
# will read data without pushing it to CDF.
debug: false
# This is for Microsoft as IdP, to use a different provider,
# set implementation: Basic, and use token-url instead of tenant.
# See the example config for the full list of options.
idp-authentication:
# Directory tenant
tenant: ${COGNITE_TENANT_ID}
# Application Id
client-id: ${COGNITE_CLIENT_ID}
# Client secret
secret: ${COGNITE_CLIENT_SECRET}
# List of resource scopes, ex:
# scopes:
# - scopeA
# - scopeB
scopes:
- ${COGNITE_SCOPE}
Timestamps and intervals
In most places where time intervals are required, you can use a CDF-like syntax of [N][timeunit]
. For example, 10m
for 10 minutes or 1h
for 1 hour. timeunit
is one of d
, h
, m
, s
, ms
. You can also use cron expressions.
For history start and end times, you can use a similar syntax. [N][timeunit]
and [N][timeunit]-ago
. 1d-ago
means 1 day in the past from the time history starts, and 1h
means 1 hour in the future. For instance, you can use this syntax to configure the extractor to read only recent history.
Source
This section contains parameters for connecting to the OPC Classic servers. The extractor can connect to multiple servers, where each server has its own ID prefix. Technically, each server may have multiple connections because DA and HDA are effectively separate servers. In practice, many servers support both DA and HDA interfaces but share information between the two.
All servers share the same authentication information. This is under the assumption that the extractor signs in to the servers using a shared domain or similar. It is considered best practice to give the extractor a separate network user.
Run multiple extractors if the extractor needs multiple sets of credentials.
Parameter | Description |
---|---|
username | Windows username to use for authentication to the servers. |
password | Windows password to use for authentication to the servers. |
domain | Domain for the user used for authentication. |
parallelism | Maximum number of requests made in parallel to each server. The default value is 10 . |
use-async | Use async mode when making requests to HDA servers. This can be more efficient both for the extractor and the server, but not all servers support it, so it's disabled by default. |
servers | A list of servers to extract from. |
servers[].host | Host or IP address to connect to. |
servers[].da-version | Version of DA to connect to on this host. This can be left out to not connect to DA at all. Valid options are V2 or V3 . |
servers[].hda-version | Version of HDA to connect to. This can be left out to not connect to HDA at all. Must be set equal to V1 if enabled. |
servers[].name | Name of the server to connect to on the given host. This is used to pick which server to connect to if multiple are available. If left out, pick the first server found. |
servers[].proxy-address | Proxy requests to the server through this address. |
servers[].id-prefix | Prefix for external IDs of assets and time series created in CDF by this server. |
servers[].state-store-name | Name of state store used to store states if history is enabled for this server. Required if hda-version is set. |
servers[].cache.path | Path to a local JSON file caching the node hierarchy. If the file doesn't exist, the extractor will browse the DA and HDA servers and generate it. The file may be manually edited to limit which nodes the extractor should read. |
attribute-chunking | Configuration for chunking of attributes read from HDA servers. |
attribute-chunking.chunk-size | Maximum number of items per attribute read request. The default value is 1000 . |
attribute-chunking.parallelism | Maximum number of parallel requests for attributes. The default value is 10 . |
keep-alive-interval | Interval between each read of server status, used as a keep alive. The syntax is described in Timestamps and intervals. |
Subscriptions
If you connect the extractor to a Data Access (DA) server, it establishes subscriptions on the tags it discovers. Subscriptions in OPC DA are callbacks, meaning that the server will call a function in the extractor whenever it sees any changes.
Parameter | Description |
---|---|
chunking | Configuration for how the extractor will chunk requests for subscriptions. |
chunking.chunk-size | Maximum number of items per subscription request. The default value is 1000 . |
chunking.parallelism | Maximum number of parallel requests to create subscriptions. The default value is 10 . |
keep-alive | Keep alive rate in milliseconds for subscriptions. The default value is 10000 . |
update-rate | Requested update rate, this is how often the server should check for updates from its underlying systems. The server is not required to obey this, and may return a revised update rate, or just use a notification based approach. The default value is 1000 |
deadband | Minimum difference in value required for an update to be registered. The default value is 0.0 |
Logger
Log entries are either Fatal
, Error
, Warning
, Information
, Debug
, Verbose
, in order of decreasing importance. Each level covers the ones of higher importance.
Parameter | Description |
---|---|
console | Configuration for logging to the console. |
console.level | Minimum level of log events to write to the console. Set this to enable console logging. |
console.stderr-level | Log events at this level or above are redirected to standard error. |
file | Configuration for logging to a rotating log file. |
file.level | Minimum level of log events to write to file. |
file.path | Path to the files to be logged. If this is, for example, set to logs/log.txt , logs on the form logs/log[date].txt will be created, depending on rolling-interval . |
file.retention-limit | Maximum number of log files that are kept in the log folder. |
file.rolling-interval | A rolling interval for log files. Either day or hour . The default value is day . |