Configuring log streaming for Db2 Warehouse
After Db2 Warehouse audit logging is enabled, you can create a log streaming pod to forward the audit logs to the IBM® Software Hub audit service.
Before you begin
Procedure
- Create environment variables for your environment.
- Run the following command to determine the name of your active
db2ucluster:oc get db2ucluster -n ${PROJECT_CPD_INST_OPERANDS} - Set the db2ucluster-name environment variable to the database
instance you want to configure log streaming for:
export DB2UCLUSTER=<db2ucluster-name> - Run the following command to determine the TLS secret of your database instance:
$ oc get secret -n ${PROJECT_CPD_INST_OPERANDS} | grep tls - Set the INSTANCE_TLS environment variable to the TLS secret for the
database instance that you want to configure log streaming for:
export INSTANCE_TLS=<instance-tls>For example, for theDB2WHinstance, you can set it to the default secret:export INSTANCE_TLS=db2wh-internal-tls
- Run the following command to determine the name of your active
-
Run the following command to confirm that audit logging is enabled and the
auditlogs PVChas been created for your deployed database.
Confirm thatoc get db2u <db2ucluster-name> -oyamlenableAuditis set totrueandauditlogs PVCis added instorage configs. - Create the log stream
pod:
cat << EOF | oc apply -f - apiVersion: db2ulog.databases.ibm.com/v1alpha1 kind: Db2uLogStream metadata: name: $DB2UCLUSTER spec: configurations: - type: audit format: cadf connection: cp4d connections: cp4d: endpoint: https://zen-audit-svc.${PROJECT_CPD_INST_OPERANDS}:9880/records credentials: $INSTANCE_TLS authType: tls resources: # this field is optional and used to control the resources of the logstreaming pod limits: cpu: "100m" memory: "300Mi" requests: cpu: "100m" memory: "300Mi" EOFNote: You can set resource limits for your log streaming pod by populating theThe log stream pod is created after applying theresourcesfields. Default values are used if you leave the fields empty.yamlfile. You can run the following commanded to verify that the pod is now active:
The command will generate output similar to the following example:$ oc get pod | grep logstreamc-db2wh-audit-test-logstream-6fb596cd5f-5r4xd 1/1 Running 0 43h