Exporting Cloud Pak for Data audit records to Splunk
Upgrade to IBM Software Hub Version 5.1 before IBM Cloud Pak for Data Version 4.8 reaches end of support. For more information, see Upgrading from IBM Cloud Pak for Data Version 4.8 to IBM Software Hub Version 5.1.
You can export your Cloud Pak for Data audit records to Splunk.
- Who needs to complete this task?
- To complete this task, you must have one of the following roles:
- Cluster administrator
- Instance administrator
- When do you need to complete this task?
- Complete this task if you want to export Cloud Pak for Data audit records to Splunk.
Before you begin
Ensure that you source the environment variables before you run the commands in this task.
About this task
Cloud Pak for Data uses the Splunk HTTP Event Collector Output Plugin to integrate with Splunk.
To export your audit records to Splunk, complete the following tasks:
- Add an HTTP event collector for Cloud Pak for Data to Splunk.
- Configure Cloud Pak for Data to send events to
Splunk.
Choose the appropriate option for your environment:
Add an HTTP event collector for Cloud Pak for Data to Splunk
From the Splunk dashboard:
- Click .
- In the HTTP Event Collector section, click Add new.
- Give the Cloud Pak for Data instance a unique name.
- In the Source name override enter a name for a source to be assigned to events that this endpoint generates.
- In the Description enter a description for the input.
- If you want to enable indexer acknowledgment for this token, select Enable indexer acknowledgment.
- Configure the source type by creating a specific Cloud Pak for Data source, or by using the automatic detecting option, or by selecting generic JSON source type.
- Configure App Context and Indexes for the specific use case.
- Click Review and then click Submit.
- Save the Generated Token Value so that it can be used in a later step.
Edit the zen-audit-config
ConfigMap
You can edit the existing zen-audit-config
ConfigMap to connect to your Splunk environment.
From the Cloud Pak for Data cluster:
- Change to the project where Cloud Pak for Data is
installed:
oc project ${PROJECT_CPD_INST_OPERANDS} - Make a backup of the current
zen-audit-configConfigMap. - Edit the
zen-audit-configConfigMap:oc edit configmap zen-audit-config - Update the ConfigMap:
- Add the
<store>configuration to the ConfigMap.Tip: Thezen-audit-configConfigMap includes a sample Splunk configuration, which is commented out by default.The
<store>configuration must be inside the<match export export.** records records.** syslog syslog.**>tag and after the@type copytag.Ensure that the entry is indented correctly.
- Replace the following variables with the appropriate values for your environment:
- <SPLUNK-HOST>
- Replace
<SPLUNK-HOST>with the address of the Splunk host. - <SPLUNK-PORT>
- Replace
<SPLUNK-PORT>with the port on the Splunk server. The default port is 8088. - <SPLUNK-TOKEN>
- Replace
<SPLUNK-TOKEN>with the token that you generated on the Splunk server.
- If you want to use TLS to connect to Splunk, replace
<XXXXXXXXX>with the contents of the Splunk TLS certificate.
The contents of the ConfigMap depend on whether you want to use TLS:
ConfigMap for connecting to Splunk using TLS (recommended)
Important: If you want to use TLS to connect to Splunk, see SSL parameters in thefluent-plugin-splunk-hecReadme on GitHub to determine which parameters you need to specify in the<store>section of the ConfigMap.apiVersion: v1 metadata: name: zen-audit-config data: ca.pem: | -----BEGIN CERTIFICATE----- <XXXXXXXXX> -----END CERTIFICATE----- fluent.conf: |- <match export export.** records records.** syslog syslog.**> @type copy <store> @type splunk_hec hec_host <SPLUNK-HOST> # Replace <SPLUNK-HOST> with the address of the Splunk host hec_port <SPLUNK-PORT> # Replace <SPLUNK-PORT>. The default port is 8088 hec_token <SPLUNK-TOKEN> # Replace <SPLUNK-TOKEN> with the token you generated flush_interval 10s # Recommended value # Add SSL parameters here ca_file /fluentd/config/ca.pem</store></match>
ConfigMap for connecting to Splunk without TLS
apiVersion: v1 metadata: name: zen-audit-config data: fluent.conf: |- <match export export.** records records.** syslog syslog.**> @type copy <store> @type splunk_hec protocol http hec_host <SPLUNK-HOST> # Replace <SPLUNK-HOST> with the address of the Splunk host hec_port <SPLUNK-PORT> # Replace <SPLUNK-PORT>. The default port is 8088 hec_token <SPLUNK-TOKEN> # Replace <SPLUNK-TOKEN> with the token you generated flush_interval 10s # Recommended value</store></match>
- Add the
- Save the changes to the
zen-audit-configConfigMap. For example, if you are usingvi, hit esc and enter :wq. - Delete all
zen-auditpods to force a restart to pick up changes:- Get the list of
zen-auditpods:oc get pods | grep zen-audit - Delete the
zen-auditpods.Tip: If there are multiplezen-auditpods, delete each pod individually to avoid a forced restart.oc delete pods zen-audit-xxxxxx-xxxReplace
zen-audit-xxxxxx-xxxwith the ID returned by theoc get podscommand.
- Get the list of
Create a custom ConfigMap
You can create a custom ConfigMap to connect to your Splunk environment.
From the Cloud Pak for Data cluster:
- Change to the project where Cloud Pak for Data is
installed:
oc project ${PROJECT_CPD_INST_OPERANDS} - Set the following environment variables:
- Set
CONFIGMAP_NAMEto the name that you want to use for the custom ConfigMap:export CONFIGMAP_NAME=<configmap-name> - If you want to use TLS, set
TLS_CERTto the TLS certificate:export TLS_CERT=<certificate> - Set
SPLUNK-HOSTto the address of the Splunk server:export SPLUNK-HOST=<hostname> - Set
SPLUNK-PORTto the port on the Splunk server. The default port is8088.export SPLUNK-PORT=<port> - Set
SPLUNK-TOKENto the token that you generated on the Splunk server:export SPLUNK-TOKEN=<token>
- Set
- Create the ConfigMap:
ConfigMap for connecting to Splunk using TLS (recommended)
Important: If you want to use TLS to connect to Splunk, see SSL parameters in thefluent-plugin-splunk-hecReadme on GitHub to determine which parameters you need to specify in the<store>section of the ConfigMap.cat <<EOF | oc apply -f - apiVersion: v1 kind: ConfigMap metadata: name: ${CONFIGMAP_NAME} namespace: ${PROJECT_CPD_INST_OPERANDS} data: ca.pem: | -----BEGIN CERTIFICATE----- ${TLS_CERT} -----END CERTIFICATE----- fluent.conf: |- <match export export.** records records.** syslog syslog.**> @type copy <store> @type splunk_hec hec_host ${SPLUNK-HOST} hec_port ${SPLUNK-PORT} hec_token ${SPLUNK-TOKEN} flush_interval 10s # Recommended value # Add SSL parameters here ca_file /fluentd/config/ca.pem </store> </match> EOF
ConfigMap for connecting to Splunk without TLS
cat <<EOF | oc apply -f - apiVersion: v1 kind: ConfigMap metadata: name: ${CONFIGMAP_NAME} namespace: ${PROJECT_CPD_INST_OPERANDS} data: fluent.conf: |- <match export export.** records records.** syslog syslog.**> @type copy <store> @type splunk_hec protocol http hec_host ${SPLUNK-HOST} hec_port ${SPLUNK-PORT} hec_token ${SPLUNK-TOKEN} flush_interval 10s # Recommended value </store> </match> EOF
- Patch the
zenServicecustom resource to specify the custom ConfigMap:oc patch zenService lite-cr \ -n ${PROJECT_CPD_INST_OPERANDS} \ --type='json' \ --patch '[{"op": "replace", "path":"/spec/zen_audit_config_custom", "value": '${CONFIGMAP_NAME}' }]' - Delete all
zen-auditpods to force a restart to pick up changes:- Get the list of
zen-auditpods:oc get pods | grep zen-audit - Delete the
zen-auditpods.Tip: If there are multiplezen-auditpods, delete each pod individually to avoid a forced restart.oc delete pods zen-audit-xxxxxx-xxxReplace
zen-audit-xxxxxx-xxxwith the ID returned by theoc get podscommand.
- Get the list of
Results
After the changes are applied, new audit events from Cloud Pak for Data are sent to Splunk.
What to do next
If you use the Identity Management Service, complete Enabling auditing for the Identity Management Service.