Configuration settings
To configure the File extractor, you must create a configuration file. The file must be in YAML format.
You can set up extraction pipelines to use versioned extractor configuration files stored in the cloud.
Using values from environment variables
The configuration file allows substitutions with environment variables. For example:
cognite:
secret: ${COGNITE_CLIENT_SECRET}
will load the value from the COGNITE_CLIENT_SECRET
environment variable into the cognite/secret
parameter. You can also do string interpolation with environment variables, for example:
url: http://my-host.com/api/endpoint?secret=${MY_SECRET_TOKEN}
Implicit substitutions only work for unquoted value strings. For quoted strings, use the !env
tag to activate environment substitution:
url: !env 'http://my-host.com/api/endpoint?secret=${MY_SECRET_TOKEN}'
Using values from Azure Key Vault
The DB extractor also supports loading values from Azure Key Vault. To load a configuration value from Azure Key Vault, use the !keyvault
tag followed by the name of the secret you want to load. For example, to load the value of the my-secret-name
secret in Key Vault into a password
parameter, configure your extractor like this:
password: !keyvault my-secret-name
To use Key Vault, you also need to include the azure-keyvault
section in your configuration, with the following parameters:
Parameter | Description |
---|---|
keyvault-name | Name of Key Vault to load secrets from |
authentication-method | How to authenticate to Azure. Either default or client-secret . For default , the extractor will look at the user running the extractor, and look for pre-configured Azure logins from tools like the Azure CLI. For client-secret , the extractor will authenticate with a configured client ID/secret pair. |
client-id | Required for using the client-secret authentication method. The client ID to use when authenticating to Azure. |
secret | Required for using the client-secret authentication method. The client secret to use when authenticating to Azure. |
tenant-id | Required for using the client-secret authentication method. The tenant ID of the Key Vault in Azure. |
Example:
azure-keyvault:
keyvault-name: my-keyvault-name
authentication-method: client-secret
tenant-id: 6f3f324e-5bfc-4f12-9abe-22ac56e2e648
client-id: 6b4cc73e-ee58-4b61-ba43-83c4ba639be6
secret: 1234abcd
Base configuration object
Parameter | Type | Description |
---|---|---|
version | either string or integer | Configuration file version |
type | either local or remote | Configuration file type. Either local , meaning the full config is loaded from this file, or remote , which means that only the cognite section is loaded from this file, and the rest is loaded from extraction pipelines. Default value is local . |
cognite | object | The cognite section describes which CDF project the extractor will load data into and how to connect to the project. |
logger | object | The optional logger section sets up logging to a console and files. |
files | object | Configure files to be extracted to CDF. |
extractor | object | General configuration for the file extractor. |
metrics | object | The metrics section describes where to send metrics on extractor performance for remote monitoring of the extractor. We recommend sending metrics to a Prometheus pushgateway, but you can also send metrics as time series in the CDF project. |
cognite
Global parameter.
The cognite section describes which CDF project the extractor will load data into and how to connect to the project.
Parameter | Type | Description |
---|---|---|
project | string | Insert the CDF project name. |
idp-authentication | object | The idp-authentication section enables the extractor to authenticate to CDF using an external identity provider (IdP), such as Microsoft Entra ID (formerly Azure Active Directory). |
data-set | object | Enter a data set the extractor should write data into |
extraction-pipeline | object | Enter the extraction pipeline used for remote config and reporting statuses |
host | string | Insert the base URL of the CDF project. Default value is https://api.cognitedata.com . |
timeout | integer | Enter the timeout on requests to CDF, in seconds. Default value is 30 . |
external-id-prefix | string | Prefix on external ID used when creating CDF resources |
connection | object | Configure network connection details |
idp-authentication
Part of cognite
configuration.
The idp-authentication
section enables the extractor to authenticate to CDF using an external identity provider (IdP), such as Microsoft Entra ID (formerly Azure Active Directory).
Parameter | Type | Description |
---|---|---|
authority | string | Insert the authority together with tenant to authenticate against Azure tenants. Default value is https://login.microsoftonline.com/ . |
client-id | string | Required. Enter the service principal client id from the IdP. |
tenant | string | Enter the Azure tenant. |
token-url | string | Insert the URL to fetch tokens from. |
secret | string | Enter the service principal client secret from the IdP. |
resource | string | Resource parameter passed along with token requests. |
audience | string | Audience parameter passed along with token requests. |
scopes | list | Enter a list of scopes requested for the token |
min-ttl | integer | Insert the minimum time in seconds a token will be valid. If the cached token expires in less than min-ttl seconds, it will be refreshed even if it is still valid. Default value is 30 . |
certificate | object | Authenticate with a client certificate |
scopes
Part of idp-authentication
configuration.
Enter a list of scopes requested for the token
Each element of this list should be a string.
certificate
Part of idp-authentication
configuration.
Authenticate with a client certificate
Parameter | Type | Description |
---|---|---|
authority-url | string | Authentication authority URL |
path | string | Required. Enter the path to the .pem or .pfx certificate to be used for authentication |
password | string | Enter the password for the key file, if it is encrypted. |
data-set
Part of cognite
configuration.
Enter a data set the extractor should write data into
Parameter | Type | Description |
---|---|---|
id | integer | Resource internal id |
external-id | string | Resource external id |
extraction-pipeline
Part of cognite
configuration.
Enter the extraction pipeline used for remote config and reporting statuses
Parameter | Type | Description |
---|---|---|
id | integer | Resource internal id |
external-id | string | Resource external id |
connection
Part of cognite
configuration.
Configure network connection details
Parameter | Type | Description |
---|---|---|
disable-gzip | boolean | Whether or not to disable gzipping of json bodies. |
status-forcelist | string | HTTP status codes to retry. Defaults to 429, 502, 503 and 504 |
max-retries | integer | Max number of retries on a given http request. Default value is 10 . |
max-retries-connect | integer | Max number of retries on connection errors. Default value is 3 . |
max-retry-backoff | integer | Retry strategy employs exponential backoff. This parameter sets a max on the amount of backoff after any request failure. Default value is 30 . |
max-connection-pool-size | integer | The maximum number of connections which will be kept in the SDKs connection pool. Default value is 50 . |
disable-ssl | boolean | Whether or not to disable SSL verification. |
proxies | object | Dictionary mapping from protocol to url. |
proxies
Part of connection
configuration.
Dictionary mapping from protocol to url.
logger
Global parameter.
The optional logger
section sets up logging to a console and files.
Parameter | Type | Description |
---|---|---|
console | object | Include the console section to enable logging to a standard output, such as a terminal window. |
file | object | Include the file section to enable logging to a file. The files are rotated daily. |
metrics | boolean | Enables metrics on the number of log messages recorded per logger and level. This requires metrics to be configured as well |
console
Part of logger
configuration.
Include the console section to enable logging to a standard output, such as a terminal window.
Parameter | Type | Description |
---|---|---|
level | either DEBUG , INFO , WARNING , ERROR or CRITICAL | Select the verbosity level for console logging. Valid options, in decreasing verbosity levels, are DEBUG , INFO , WARNING , ERROR , and CRITICAL . Default value is INFO . |
file
Part of logger
configuration.
Include the file section to enable logging to a file. The files are rotated daily.
Parameter | Type | Description |
---|---|---|
level | either DEBUG , INFO , WARNING , ERROR or CRITICAL | Select the verbosity level for file logging. Valid options, in decreasing verbosity levels, are DEBUG , INFO , WARNING , ERROR , and CRITICAL . Default value is INFO . |
path | string | Required. Insert the path to the log file. |
retention | integer | Specify the number of days to keep logs for. Default value is 7 . |
files
Global parameter.
Configure files to be extracted to CDF.
Parameter | Type | Description |
---|---|---|
file-provider | configuration for either Local Files, Sharepoint Online, FTP/FTPS, SFTP, GCP Cloud Storage, Azure Blob Storage, Samba, AWS S3 or Documentum | Configure a file provider for where the files are extracted from. |
extensions | list | List of file extensions to include. If left out, all file extensions will be allowed. |
labels | list | List of label external IDs to add to extracted files. |
security-categories | list | List of security category IDs to add to extracted files. |
max-file-size | either string or number | Maximum file size of files to include. Set to -1 to allow any file size. Syntax is N(KB|MB|GB|TB|KiB|miB|GiB|TiB) . Note that the extractor supports files up to 1000GiB. Default value is 100GiB . |
with-metadata | boolean | Add metadata extracted from the file source to files in CDF. |
directory-prefix | string | Prefix to add to all extracted file directories. |
metadata-to-raw | object | If this is configured, write metadata to a table in CDF Raw instead of files. |
data_model | object | When this is provided, all files metadata are uploaded to Data models, hence metadata-to-raw becomes redundant. |
source | object | Sets the 'Source' metadata field for the related files. When data modelling is set, it updates the underlying CogniteSourceSystem with the correspondent source.This is an optional parameter. |
filter | configuration for either And, Or, Not, Equals or In | |
delete-behavior | object | What the extractor should do with files that were removed from the source. |
missing-as-deleted | boolean | Whether the extractor should treat files that were not returned from the source as deleted. |
file-provider
Part of files
configuration.
Configure a file provider for where the files are extracted from.
Either one of the following options:
- Local Files
- Sharepoint Online
- FTP/FTPS
- SFTP
- GCP Cloud Storage
- Azure Blob Storage
- Samba
- AWS S3
- Documentum
local_files
Part of file-provider
configuration.
Read files from a local folder. This file provider will recursively traverse the given path and extract all discovered files.
Examples:
type: local
path: /some/local/path
type: local
path:
- /some/local/path
- /another/path
Parameter | Type | Description |
---|---|---|
type | string | Select the type of file provider. Set to local for local files. |
path | configuration for either string or list | |
use-relative-directory | boolean | Set CDF metadata 'Directory' to the file relative path. When set to 'false', CDF directory will be set to the full folder path. Default value is True . |
ignore_patterns | configuration for either String or Pattern with flags | Any file path that matches this pattern will be ignored. |
ignore_patterns
Part of local_files
configuration.
Any file path that matches this pattern will be ignored.
Either one of the following options:
pattern_with_flags
Part of ignore_patterns
configuration.
Parameter | Type | Description |
---|---|---|
pattern | string | Pattern string |
flags | either a or i |
sharepoint_online
Part of file-provider
configuration.
Read files from one or more sharepoint online sites.
Example:
type: sharepoint_online
client-id: ${SP_CLIENT_ID}
client-secret: ${SP_CLIENT_SECRET}
tenant-id: ${SP_AZURE_TENANT_ID}
paths:
- url: ${SP_EXTRACT_URL}
Parameter | Type | Description |
---|---|---|
type | string | Required. Select the type of file provider. Set to sharpeoint_online for sharepoint online. |
client-id | string | Required. Enter the App registration client ID. |
client-secret | string | Enter the App registration secret. |
certificate-path | string | Enter the path to a certificate used for authentication. Either this, client-secret , or certificate-data must be specified. |
certificate-data | string | Provide authentication certificate data directly. |
tenant-id | string | Required. Enter the Azure tenant containing the App registration. |
paths | list | Required. Enter a list of sharepoint base URLs to extract from. |
datetime-format | string | Format string for timestamp metadata. Default value is %Y-%m-%dT%H:%M:%SZ . |
extract-columns | object | Extract Sharepoint columns as metadata. This is a map from column names in Sharepoint to the name you want to extracted columns to have in file metadata in CDF. Example: {'columnNameInSharepoint': 'metadataNameInCdf'} |
restrict-to | object | Restrict to extract only files visible to a given Sharepoint Group or SiteUser. Important: In order to use this, the extractor MUST authenticate to Sharepoint online using a certificate, NOT a client secret. |
ignore_patterns | configuration for either String or Pattern with flags | Any file path that matches this pattern will be ignored. |
paths
Part of sharepoint_online
configuration.
Enter a list of sharepoint base URLs to extract from.
Each element of this list should be an a sharepoint base URL to extract from.
Parameter | Type | Description |
---|---|---|
url | string | Required. URL to the Sharepoint location you want to extract from. This can be the url to a site, a document library, or to a file or folder inside the library. |
recursive | boolean | Whether to traverse into subfolders or not, for this path. Default value is True . |
extract-columns
Part of sharepoint_online
configuration.
Extract Sharepoint columns as metadata. This is a map from column names in Sharepoint to the name you want to extracted columns to have in file metadata in CDF.
Example:
columnNameInSharepoint: metadataNameInCdf
Parameter | Type | Description |
---|---|---|
Any string | string | Name of metadata field in CDF. |
restrict-to
Part of sharepoint_online
configuration.
Restrict to extract only files visible to a given Sharepoint Group or SiteUser. Important: In order to use this, the extractor MUST authenticate to Sharepoint online using a certificate, NOT a client secret.
Parameter | Type | Description |
---|---|---|
group-id | string | The ID of a Sharepoint Group |
username | string | The "login name" of a SiteUser. This can be useful if you for example want to restrict extraction to the built-in "all users" SiteUser. |
ignore_patterns
Part of sharepoint_online
configuration.
Any file path that matches this pattern will be ignored.
Either one of the following options:
pattern_with_flags
Part of ignore_patterns
configuration.
Parameter | Type | Description |
---|---|---|
pattern | string | Pattern string |
flags | either a or i |
ftp/ftps
Part of file-provider
configuration.
Read files from an FTP server.
Example:
type: ftp
host: ftp.myserver.com
username: username
password: ${FTP_PASSWORD}