Splunk operator with Logging operator
This guide describes how to collect application and container logs in Kubernetes using the Logging operator, and how to send them to Splunk.
Logging operator collects the logs from the application, selects which logs to forward to the output, and sends the selected log messages to the output (in this case, to Splunk). For more details about the Logging operator, see the Logging operator overview.
Deploy Splunk
First, deploy Splunk Standalone in your Kubernetes cluster. The following procedure is based on the Splunk on Kubernetes quickstart.
-
Create the
logging
Namespace. -
Install the Splunk operator.
-
Install the Splunk cluster.
Deploy the Logging operator and a demo Application
Install the Logging operator and a demo application to provide sample log messages.
Deploy the Logging operator with Helm
To install the Logging operator using Helm, see Deploy the Logging operator with Helm.
-
Create the
logging
resource.Note: You can use the
ClusterOutput
andClusterFlow
resources only in thecontrolNamespace
. -
Get a Splunk HEC Token.
-
Create a Splunk output secret from the token.
-
Define a Splunk
output
. -
Create a
flow
resource. -
Install log-generator to produce logs with the label
app.kubernetes.io/name: log-generator
Validate the deployment
To validate that the deployment was successful, complete the following steps.
-
Use the following command to retrieve the password of the
admin
user: -
Enable port forwarding to the Splunk Dashboard Service.
-
Open the Splunk dashboard in your browser: http://localhost:8000. You should see the dashboard and some sample log messages from the demo application.
If you don’t get the expected result you can find help in the troubleshooting section.