Elastic PostgreSQL connector reference
editElastic PostgreSQL connector reference
editThe Elastic PostgreSQL connector is a connector for PostgreSQL.
Availability and prerequisites
editThis connector is available as a connector client from the Python connectors framework. To use this connector, satisfy all connector client requirements.
This connector is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.
Usage
editTo use this connector as a connector client, use the build a connector workflow. See Connector clients and frameworks.
Users must set track_commit_timestamp
to on
.
To do this, run ALTER SYSTEM SET track_commit_timestamp = on;
in PostgreSQL server.
For additional operations, see Usage.
For an end-to-end example of the build a connector workflow, see PostgreSQL connector client tutorial.
Compatibility
editPostgreSQL versions 11 to 15 are compatible with Elastic connector frameworks.
Configuration
editWhen using the build a connector workflow, intially these fields will use the default configuration set in the connector source code.
Note that this data source uses the generic_database.py
connector source code.
Refer to postgresql.py
for additional code, specific to this data source.
These configurable fields will be rendered with their respective labels in the Kibana UI.
Once connected, users will be able to update these values in Kibana.
Set the following configuration fields:
-
host
-
The server host address where the PostgreSQL is hosted. Examples:
-
192.158.1.38
-
demo.instance.demo-region.demo.service.com
-
-
port
-
The port where the PostgreSQL is hosted. Examples:
-
5432
-
9090
-
-
username
- The username of the PostgreSQL account.
-
password
- The password of the PostgreSQL account.
-
database
-
Name of the PostgreSQL database. Examples:
-
employee_database
-
customer_database
-
-
tables
-
Comma-separated list of tables. The PostgreSQL connector will fetch data from all tables present in the configured database, if the value is
*
. Default value is*
. Examples:-
table_1, table_2
-
*
-
-
fetch_size
-
The number of rows to fetch on each request to the PostgreSQL.
Default value is
50
. -
retry_count
-
The number of retry attempts after failed request to the PostgreSQL.
Default value is
3
. -
ssl_disabled
-
Whether SSL verification will be disabled.
Default value is
True
. -
ssl_ca
-
Content of SSL certificate. If SSL is disabled, keep the
ssl_ca
field empty.Expand to see an example certificate
-----BEGIN CERTIFICATE----- MIID+jCCAuKgAwIBAgIGAJJMzlxLMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNVBAYT AlVTMQwwC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ZbTjq9WaekGrpKkMaQA iQt5b67jo7y63CZKIo9yBvs7sxODQzDn3wZwyux2vPegXSaTHR/rop/s/mPk3YTS hQprs/IVtPoWU4/TsDN3gIlrAYGbcs29CAt5q9MfzkMmKsuDkTZD0ry42VjxjAmk xw23l/k8RoD1wRWaDVbgpjwSzt+kl+vJE/ip2w3h69eEZ9wbo6scRO5lCO2JM4Pr 7RhLQyWn2u00L7/9Omw= -----END CERTIFICATE-----
Documents and syncs
edit- Tables must be owned by a PostgreSQL user.
- Database superuser privileges are required to index all database tables.
- Tables with no primary key defined are skipped.
-
To fetch the last updated time in PostgreSQL,
track_commit_timestamp
must be set toon
. Otherwise, all data will be indexed in every sync.
Sync rules
edit- Permissions are not synced. All documents indexed to an Elastic deployment will be visible to all users with access to that deployment.
- Filtering rules are not available in the present version. Currently filtering is controlled via ingest pipelines.
Connector client operations
editEnd-to-end testing
editThe connector framework enables operators to run functional tests against a real data source. Refer to Connector testing for more details.
To perform E2E testing for the PostgreSQL connector, run the following command:
$ make ftest NAME=postgresql
For faster tests, add the DATA_SIZE=small
flag:
make ftest NAME=postgresql DATA_SIZE=small
Known issues
editThere are no known issues for this connector. Refer to Known issues for a list of known issues for all connectors.
Troubleshooting
editSee Troubleshooting.
Security
editSee Security.
Framework and source
editThis connector is included in the Python connectors framework.
This connector uses the generic database connector source code (branch 8.7, compatible with Elastic 8.7).
View additional code specific to this data source (branch 8.7, compatible with Elastic 8.7).