Observability: Integration in Splunk via OpenTelemetry

In short
  • Microservices: Monitoring and observability are complementary.
  • Difference between logs and traces.
  • Introduction to Splunk Enterprise and OpenTelemetry.
  • Deploying the collector and working with logs using SPL.

Introduction

Containerized architectures associated with microservices have significantly increased the complexity of application monitoring and tracking.

By increasing the number of assets and passing data (or user requests) through many functions that, when combined, provide the desired service, it becomes difficult to identify a faulty component.

Monitoring vs. Observability... Monitoring & Observability

Traditionally, we use monitoring for this. The goal is to monitor the state of a system using predefined indicators. Everything relies on thresholds associated with key metrics.

However, in case of a problem, this may not be sufficient. While monitoring can help resolve many incidents, it does not always help identify a functional anomaly. Knowing that a CPU is running at 99% is one thing... knowing why is another.

We will therefore move towards observability. This refers to the ability of a system to provide sufficient internal information to understand what is happening, especially when there is an issue. To achieve this, we will rely on the monitoring mentioned earlier and its associated metrics, as well as logs and traces.

Criterion Monitoring Observability
Purpose Monitoring known problems Understanding unknown problems
Nature Reactive Proactive and analytical
Dependence on thresholds High (thresholds, rules, alerts) Low (dynamic exploration)
Tools Traditional, infrastructure-focused Modern, application and flow-focused
Usage Alerting, simple dashboards Debugging, root cause analysis, correlation
Data Aggregated and simple. Rich Correlated and explorable

In short, monitoring alerts you when something goes wrong, while observability helps you understand why it went wrong. This second point becomes very important when dealing with identifying a problem in an application composed of multiple containers that communicate with each other across many network nodes.

The monolithic application has the advantage of reducing the scope of investigation... although even here, observability can be a valuable asset.

Logs and Traces: Are they the same?

It is also important to differentiate between logs and traces.

A log is a timestamped text message emitted by an application or system that describes a specific event or state.

A trace represents the complete path of a request (or transaction) through multiple services or components

Characteristic Log Trace
Main objective Describe an event or action Track the path of a request
Format Text Hierarchical structure (spans)
Correlation Often isolated Correlated
Context Local Global
Temporality Individually timestamped Ordered with durations
Analysis Searching for messages Performance analysis, bottlenecks

Introduction to Splunk Enterprise

Splunk Logo

Click the image to enlarge.

As is often the case in IT, there is no single answer to address these challenges. You can choose to use different specialized tools. Some are more focused on monitoring, while others are geared towards observability. Some vendors also offer complete suites that can support all needs.

Personally, I like to combine tools and find the best aspects of each. However, I don't want to fall into the "toolbox" syndrome, where you end up collecting all the latest trends without truly mastering them.

In the list of applications with which I work, there is Splunk Enterprise from the same-named vendor. Originally conceived as a log repository where you can dump any structured data, Splunk has become a complete ecosystem extensible through many third-party features, both free and paid.

Splunk works thanks to an internal engine that stores data in indexes, and then extracts fields to be used in queries using a language inspired by SQL (the SPL: Splunk Search Processing Language).

It is now possible to correlate information by combining queries of multiple indexes through a standardization of field names. For example, you can start by identifying a source IP address from a firewall log, and then find it in the logs of a web server to track its activity and easily identify the data it has accessed.

You can use SPL (Splunk Processing Language) to group everything within dashboards and perform statistical calculations, such as extracting the time taken for a request to travel from the firewall to the website. This provides a performance metric that can help you identify communication problems within the system.

This is similar to a well-known open-source tool like ELK (Elastic Stack). The notable difference between the two products is that most of the field extraction and their operations are performed in Splunk after indexing. This means that the data is always "raw" without specific modifications (except for exceptions), and it is during the querying of the data that fields are extracted and manipulated.

This implies that it becomes possible to easily modify the segmentation and naming of fields without having to reindex the data.

To facilitate this manipulation of fields, Splunk has a "store" where you can find technical add-ons that automate the segmentation and extraction of fields based on the source.

In addition to these technical add-ons, the store also contains what are called apps. These are extensions to Splunk, including pre-built dashboards and preconfigured field segmentations, making it much easier to track events related to a specific product.

Some apps are free, while others are paid. They can be offered by Splunk, partners, other vendors, equipment manufacturers, or the community. It becomes very easy to integrate and utilize your logs when you use known solutions and/or hardware.

Two major apps developed directly by Splunk are:

  • Splunk Enterprise Security: this is the vendor's SIEM solution (Security Information and Event Management). It enables the collection, correlation, analysis and alerting of security events in an information system. It has become the flagship application.
  • Splunk Observability Cloud: This is the observability suite that combines metrics and logs from on-premise and cloud infrastructure/applications within an information system.

It remains important to understand that, regardless of the application, all of them run on the Splunk Base engine and layer, which can be used alone to build your own dashboards and create your own field extractions, even developing your own applications.

Splunk Platform

Click the image to enlarge.

Unfortunately, Splunk is not a free solution. The vendor is also known for having high pricing, knowing that it is possible to install the tool and apps on-premise, or subscribe to a managed SaaS offering. Several license models exist, such as paying for a daily quantity of indexed data.

However, it is still possible to install Splunk Enterprise and use it for free under certain conditions, with a daily indexing limit of 500MB.

This is already useful for learning the tool, getting an idea of its capabilities, or even keeping it that way for a small infrastructure.

It is thanks to this free offering that I can create this article.

The goal here is not to go into detail about how Splunk works, but rather to illustrate the theory with practice.

I also want to give you an overview of what is possible around a Kubernetes platform.

We will deploy Splunk on a Rocky Linux 9.6 VM and then use it to collect and analyze all logs from my Kubernetes cluster.

Introduction to OpenTelemetry

OpenTelemetry Logo

Click the image to enlarge.

This will also be an opportunity to discuss a "tool" that continues to generate discussion: OpenTelemetry.

Although Splunk is a paid solution, the vendor is very involved in certain open-source products and relies partly on them to design its offering.

OpenTelemetry is an open-source standard that allows you to collect, structure, and export observability data, namely metrics, logs, and distributed traces, as mentioned at the beginning of this article.

Splunk is a major contributor to the project and invests in its development and use.

OpenTelemetry revolves around the following key components:

Component Role
Client SDKs Integrated into the code (Python, Java, Go, etc.) to capture traces/metrics/logs
Collector (agent) A process that receives data, processes it, and sends it to a backend
Exporters Adapters for backends (Splunk, Prometheus, OTLP, Jaeger, etc.)
Instrumentation Ready-to-use libraries for frameworks (Django, Flask, Spring, etc.)
Protocol OTLP (OpenTelemetry Protocol), a performant and standardized protocol
OpenTelemetry Components

Click the image to enlarge.

The advantage of a standard like Open Telemetry is that you can rely on a single data collection agent, regardless of the final processing, provided that it is compatible with OpenTelemetry.

We also benefit from a common dictionary around the items to be collected.

OpenTelemetry therefore enables application monitoring/observability with a single language and protocol while maintaining backend flexibility.

To integrate Kubernetes into Splunk, we will deploy pre-packaged OpenTelemetry agents on each node.

This will involve using an agent provided by Splunk, but which remains based on the OpenTelemetry standard.

Deployment

Installing Splunk Enterprise

Using the RPM package

To obtain the Splunk binaries, simply create a free account on the vendor's website. You do not need a professional email address.

Once the account is created and connected to the site, you can download Splunk Base (Splunk Enterprise) in various formats.

For the purposes of this article, we will choose the rpm package.

You can directly retrieve the wget command to obtain it on the target server that will host the solution.

Retrieving sources from the website

Click the image to enlarge.

wget -O splunk-9.4.3-237ebbd22314.x86_64.rpm "https://download.splunk.com/products/splunk/releases/9.4.3/linux/splunk-9.4.3-237ebbd22
Using the wget command

Click the image to enlarge.

The version needs to be adjusted

We are using a RocyLinux 9.6 VM with 8 vCPUs, 16GB of memory, and 120GB of disk (SSD is mandatory). Splunk can potentially consume significant resources. Be aware that, depending on the volume of your logs, your SSDs may quickly become overloaded.

As a side note, I often write my articles in multiple sessions before arriving at the final result, sometimes leaving a few days between writing sessions. 48 hours were enough to cause my VM to fail due to a disk error. Fortunately, I was able to identify the issue before the crash and thanks to Splunk... that one of my pods was responsible for sending a very large amount of logs. I therefore stopped this pod, restored my VM (thank you gparted) and continued my tutorial.

Disk error

Click the image to enlarge.

Normally, for a production installation, Splunk Enterprise is deployed on different servers, with some servers only having a limited number of functions enabled.

We will find, for example, indexers, which are only responsible for receiving data. It is possible to have pools of indexers that can duplicate the data if necessary or distribute the load. We will also install search heads, this time dedicated to querying the data and building dashboards.

It is possible to reserve search heads for specific uses or teams, as Splunk allows granular rights management at multiple levels. Other sub-components can be deployed, but it is important to understand that most of these are always deployed from the same binary. We then adjust the configuration of the installed layer to enable or disable certain functions.

Example of a Splunk architecture

Click the image to enlarge.

In our case, we will leave everything enabled to use an "all-in-one" installation where the indexer and search head are on the same server.

Before starting the installation, it is recommended to create a dedicated user:

useradd splunk
Creating the splunk user

Click the image to enlarge.

Once the package is on the server, you can start the installation with the following command:

dnf install -y splunk-9.4.3-237ebbd22314.x86_64.rpm
Starting the Splunk installation

Click the image to enlarge.

Next, we switch to the splunk user context to run the instance for the first time:

su - splunk
Switching to the Splunk user context

Click the image to enlarge.

/opt/splunk/bin/splunk start --accept-license
First launch of Splunk

Click the image to enlarge.

We are asked to enter the username and password for the admin account.

Configuring the admin user

Click the image to enlarge.

Once the instance is started, we can immediately stop it.

/opt/splunk/bin/splunk stop
Stopping the instance

Click the image to enlarge.

We return to the root user. We enable Splunk support via systemd to obtain automatic startup of the instance. It is important to note that we want to use a dedicated user for the application to prevent the instance from starting with the root account.

/opt/splunk/bin/splunk enable boot-start -user splunk -systemd-managed 1
Enabling automatic startup

Click the image to enlarge.

After configuring automatic startup, we start the instance and ensure that everything is working correctly.

systemctl enable Splunkd systemctl start Splunkd systemctl status Splunkd
Restarting the service and checking its status

Click the image to enlarge.

At this stage, Splunk Enterprise is started and ready to be used.

Creating the certificate

However, before accessing the interface, we will use a certificate to properly use HTTPS.

I will not go into detail. It involves generating your CSR (Certificate Signing Request) and private key with OpenSSL. In my example, my server is called prdinfobs501.coolcorp.priv, and I want to use the URL HTTPS://log.coolcorp.priv. Here is the command associated with my case:

openssl req -new -nodes -sha256 -keyout log.coolcorp.priv.key -out log.coolcorp.priv.csr -newkey rsa:4096 -subj "/C=FR/ST=Ile-de-France/L=Paris/O=COOLCORP/OU=Infrastructure/CN=log.coolcorp.priv" -reqexts SAN -config <(printf "[req]\ndistinguished_name = req_distinguished_name\n[req_distinguished_name]\n[SAN]\nsubjectAltName=DNS:log.coolcorp.priv,DNS:prdinfobs501.coolcorp.priv")
Creating the private key and CSR (Certificate Signing Request)

Click the image to enlarge.

I use the CSR (Certificate Signing Request) obtained to generate my certificate via my internal PKI (a Windows CA). Each user should adapt this according to their situation (you can also simply use HTTP…)

Retrieving the certificate

Click the image to enlarge.

I copy my key and certificate to the server in the folder /opt/splunk/etc/auth/certs

(I will create the folder if needed)

cd /opt/splunk/etc/auth/ mkdir certs
Creating the folder for the key and certificate

Click the image to enlarge.

Copying the key and certificate

Click the image to enlarge.

I modify the configuration file /opt/splunk/etc/system/local/web.conf to enable HTTPS support and specify the key and certificate to use.

vi /opt/splunk/etc/system/local/web.conf
[settings]
enableSplunkWebSSL = true
privKeyPath = /opt/splunk/etc/auth/certs/log.coolcorp.priv.key
serverCert = /opt/splunk/etc/auth/certs/log.coolcorp.priv.cer
Configuring the web server to recognize the certificate

Click the image to enlarge.

I restart Splunk

systemctl restart Splunkd
Restarting the service

Click the image to enlarge.

The Splunk web server listens by default on port 8000. To allow this, I execute the following command in firewalld:

firewall-cmd—add-port=8000/tcp—permanent firewall-cmd—reload
Opening the firewall for the website

Click the image to enlarge.

We can now connect as an administrator to the URL HTTPS://log.coolcorp.priv to start using the tool.

Connecting to the interface

Click the image to enlarge.

Configuring Splunk Enterprise

Upon arriving at the interface, you will have few apps installed. The most important one is called Search & Reporting. You can perform your searches from this app.

Creating the app

It is not recommended to stay within the context of this app, but rather to create a dedicated app for your needs. In our example, I want to be able to explore the logs of the containers running on my Kubernetes cluster.

I go to the application management menu to create a new one.

Apps management menu

Click the image to enlarge.

Creating the application

Click the image to enlarge.

I give it a name, app-coolcorp-k8s, and tell Splunk where to store the elements that I might need to create for my app.

Configuring the application

Click the image to enlarge.

In fact, under Splunk, an app is represented by a folder that will contain all the elements that could be related to it, such as dashboards or field extraction definitions. Within this folder, everything is files, making it possible to package your app for distribution and deployment on other Splunk instances. I won't go into that level of detail today; just remember that, under Splunk, using a "app"-based segmentation within your instance is a good practice.

Once my app is created, I can go to its context. By default, my app inherits the configuration of the Search & Reporting app. However, I am now in my app, and everything I do will be saved and associated with it.

I know that I am in the context of my app by observing the URL, which refers to it.

Switching to the app context

Click the image to enlarge.

Creating the index

I can now create an index. An index is like a database dedicated to hosting collected logs. By default, there is a main index, which, without explicit configuration, is used by default.

Index creation menu

Click the image to enlarge.

In this area as well, best practice dictates that you should avoid using this index. This is because the lifecycle of your collected data is associated with an index. I won't go into the details, but it is possible to define, by index, the amount and/or history of data that you want to retain before Splunk cleans up or moves the data to a different storage medium (archiving).

Creating the index

Click the image to enlarge.

It should also be noted that, as with apps, it is possible to associate specific permissions for viewing an index. This makes it very interesting to segment your data into multiple indexes based on the confidentiality of the data.

For example, I am creating an index named idx-coolcorp-k8s dedicated to storing my K8S logs.

Configuring the index

Click the image to enlarge.

The definition of my index is saved in the context of my app.

Still being careful to stay within this context, I will define the entry point for the data to be collected.

Creating the HTTP collector

Splunk can ingest data in various ways. For Kubernetes, we will use sending via an HTTP collector. This is a way for Splunk to listen on a port dedicated to this purpose and to receive the log stream through it.

We are now in the Data Input menu, then we select HTTP event collector.

Data inputs menu

Click the image to enlarge.

Creating an HTTP collector

Click the image to enlarge.

We will leave most of the options at their defaults, including the choice of sourcetype. For Splunk, the sourcetype is associated with the nature of the data. Based on the sourcetype, Splunk knows how to extract and manipulate the fields it receives. Some sourcetypes are known by default in Splunk, but it is possible to extend these and supplement them with your own field extraction rules.

Configuring the collector

Click the image to enlarge.

This is often what you will find when deploying a technical add-on.

In our example, we will let the sourcetype be detected automatically.

However, we will force the data collected through this method to be stored in the index created just before.

Configuring the index for the collector

Click the image to enlarge.

Summary of the collector configuration

Click the image to enlarge.

At the end of the configuration, Splunk returns a token. This is the token that the OpenTelemetry agent must present in order to be authorized to "push" the collected logs. In this way as well, the data can be identified and associated with the dedicated index.

Retrieving the token

Click the image to enlarge.

The last thing to do is open the listening port used by the HTTP collector, which is 8088. Note that the certificate created earlier for the website will also be used to protect the sending of logs. It will be automatically reused by the HTTPS collector.

firewall-cmd --add-port=8088/tcp --permanent firewall-cmd --reload
Opening the firewall for the collector's port

Click the image to enlarge.

Installing the OpenTelemetry agent

Now, we're going to proceed with installing the OpenTelemetry agent on the cluster.

We will use a pre-configured agent that can be deployed using a Helm chart provided by Splunk.

All the details are available on the dedicated GitHub repository.

GitHub repository for the Splunk OpenTelemetry agent

Click the image to enlarge.

To adhere to my naming conventions and the logic used within my cluster, I want to dedicate a namespace to the agent.

Feel free to browse my cookbook on deploying my main Kubernetes cluster to learn more about my use of namespaces.

I start by creating the inf-sup-lan namespace on my K8S cluster using the following command:

kubectl create ns inf-sup-lan
Creating the namespace

Click the image to enlarge.

Next, I run a command from the Helm tool, which was previously configured during the cluster deployment phase.

First, you need to declare the chart repository:

helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart

Then, we initiate the installation process of the pre-configured OpenTelemetry agent provided by Splunk, using the following parameters:

helm install my-splunk-otel-collector --set="splunkPlatform.endpoint=https://log.coolcorp.priv:8088/services/collector,splunkPlatform.token=le_token_du_collector,splunkPlatform.metricsIndex=k8s-metrics,splunkPlatform.index=idx-coolcorp-k8s,clusterName=kub.coolcorp.priv,splunkPlatform.insecureSkipVerify=true,logsEngine=otel" splunk-otel-collector-chart/splunk-otel-collector -n inf-sup-lan
Starting the agent installation via Helm

Click the image to enlarge.

As you can see in the command, I'm also passing a number of arguments. Specifically, which servers to send the data to, which index to use (even though this is already enforced on the Splunk side), and the token associated with my HTTP collector.

You can quickly observe that an OpenTelemetry agent is deployed on each node in my cluster.

kubectl get pod -n inf-sup-lan -o wide
Displaying the agents

Click the image to enlarge.

Finally, almost... In fact, I don't see any agents on my nodes in the DMZ. As defined in the presentation of my cluster from my k8S cookbook, my cluster has two worker nodes in the DMZ. I have tagged them and applied a "taint" using the node-role.kubernetes.io/worker-dmz attribute.

To deploy pods to these nodes, they must be "tolerant" to these "taints", as I explain here.

However, by default, the pods deployed by Helm do not have these "tolerances" enabled. Therefore, I need to update the agent deployment to include tolerances for the control plane, to ensure that I have an agent on each node in the cluster.

This can be done using the following command to update the deployment:

helm upgrade my-splunk-otel-collector splunk-otel-collector-chart/splunk-otel-collector --reuse-values --set "tolerations[0].key=node-role.kubernetes.io/worker-dmz" --set "tolerations[0].operator=Exists" --set "tolerations[0].effect=NoSchedule" -n inf-sup-lan
helm upgrade my-splunk-otel-collector splunk-otel-collector-chart/splunk-otel-collector \
  --reuse-values \
  --set "tolerations[0].key=node-role.kubernetes.io/worker-dmz" \
  --set "tolerations[0].operator=Exists" \
  --set "tolerations[0].effect=NoSchedule" \
  --set "tolerations[1].key=node-role.kubernetes.io/control-plane" \
  --set "tolerations[1].operator=Exists" \
  --set "tolerations[1].effect=NoSchedule" \
  -n inf-sup-lan
Updating the agent installation

Click the image to enlarge.

For those who are not comfortable with Helm, feel free to read my article on deploying Jenkins under K8S, in which I explain how Helm works.

After updating the deployment using this new Helm command, we can once again check the status of the agents.

kubectl get pod -n inf-sup-lan -o wide
Displaying the agents

Click the image to enlarge.

This time, I have one agent per node. This will allow OpenTelemetry to collect logs from all containers running on each server.

These logs will then be redirected to my Splunk instance, presenting the token configured during agent installation and obtained from the HTTP collector.

In this way, the Splunk server will authorize the stream and index its content in the idx-coolcorp-k8s index.

Working with logs

We can verify this by returning to the Splunk interface and navigating to the context of the app-coolcorp-k8s app.

The SPL language is relatively easy to learn, at least its basics. For example, reading the contents of the index simply involves typing:

index="idx-coolcorp-k8s"
Viewing the index logs

Click the image to enlarge.

To be sure to see all fields, we switch to verbose mode. This mode consumes more resources, but it allows Splunk to extract the maximum number of fields. In a normal operating situation, you will tend to use intelligent mode, which allows Splunk to extract only the fields that are relevant to your query.

Choosing the search mode

Click the image to enlarge.

Here, with this default mode, we have a complete view of all fields automatically extracted from the logs of the containers running on the Kubernetes cluster.

Since we did not specify any sourcetypes during loading, Splunk automatically creates one for each container, in the format kube:container:container_name.

Displaying the sourcetypes

Click the image to enlarge.

If this approach does not suit you, since the Splunk agent is based on OpenTelemetry, you can use annotations within the Kubernetes deployment objects to override this type of information.

For example, if I modify the YAML file associated with my website in this way.

---
apiVersion: apps/v1
kind: Deployment
metadata:
 name: deploy-myprivatelab-default
 namespace: prd-myprivatelab-dmz
 labels:
    environment: prd
    network: dmz
    application: myprivatelab
    tier: default
spec:
 selector:
   matchLabels:
     environment: prd
     network: dmz
     application: myprivatelab
     tier: default
 replicas: 1  
 template:
   metadata:
     namespace: prd-myprivatelab-dmz
     labels:
        environment: prd
        network: dmz
        application: myprivatelab
        tier: default
     annotations:
        splunk.com/sourcetype: privatelab:website  

I will be able to search for related records by filtering using this new sourcetype that I have forced by annotating the K8S object.

Overriding the sourcetype

Click the image to enlarge.

We can also extend this principle using other annotations:

template:
  metadata:
    annotations:
      splunk.com/sourcetype: "my_custom_sourcetype"
      splunk.com/index: "my_index"
      splunk.com/source: "my_app"
      splunk.com/ignore: "false"

Knowing that you can also create your own annotations, for example, to add additional fields. The advantage is that the field separation is done automatically because of the use of the pre-configured OpenTelemetry agent, which emits a log stream in such a way that Splunk can directly interpret the fields according to a default configuration.

It is also important to note that the search and extraction are performed over a given time range. By default, this is 24 hours. However, it is possible to specify the period with extreme precision. The wider the time range, the more data will be processed and displayed: the query will consume resources.

That's why, when you get used to working with Splunk, you quickly need to learn how to optimize your searches to filter what you want to display as effectively as possible.

The date used to associate an event does not necessarily correspond to the date of entry into the system. If your log contains a date field, it can very well be considered the field to which the data should be displayed. Understand that, for example, if your source comes from an asset with an incorrect date or if the date field in the log is not correct, Splunk might still consider this time indicator as the date to use...which could skew your selection of time ranges.

But once again, the goal is not to create an advanced tutorial on Splunk.

In our case, all seem to match. In fact, we are displaying in Splunk what you would see with the kubectl log command. The only difference is that we are indexing all the output from all containers in the cluster.

We can start filtering logs from specific images, a particular namespace, or any other field that can be used and is directly detected by Splunk.

For example, if I want to see the logs for my website, knowing that it is located in a pod in the prd-myprivatelab-dmz namespace, I just need to filter on index="idx-coolcorp-k8s" "k8s.namespace.name"="prd-myprivatelab-dmz".

First example of filtering on a field

Click the image to enlarge.

List of available fields

Click the image to enlarge.

Of course, you can use regular expressions and filters on characters, as well as specific Splunk instructions, to obtain a more suitable display.

For example, by renaming fields and not displaying them in a table:

index="idx-coolcorp-k8s" 
| sort _time | eval date=strftime(_time, "%Y-%m-%d %H:%M:%S")
| rename k8s.cluster.name as cluster k8s.node.name as node k8s.pod.name as pod k8s.container.name as container _raw as log k8s.namespace.name as namespace 
| table date, cluster, node, namespace, pod, container, log

Although long, the command is relatively simple to understand:

  1. We sort the data by date
  2. We are working on the date format for display
  3. We are renaming the default fields with more descriptive names
  4. We are displaying everything in a table

The | character is used to pass the results of one instruction to another.

Result of the query

Click the image to enlarge.

All of this is just the tip of the iceberg. SPL allows you to go very far in data manipulation by integrating the concept of tracking over time, for example, to obtain the evolution of a specific event identifiable via the value of one or more fields (such as the number of errors during the day).

I encourage you to explore all that is possible by reviewing the Splunk documentation, which is very well done. Moreover, AI can now assist you effectively in building your SPL queries.

The ultimate goal is to use the results of these searches in dashboards, which we will be able to make dynamic through the integration of menus that are easily manipulated by a user.

For example, I can save my previous query to send it to a dashboard.

Saving my query for a dashboard

Click the image to enlarge.

After some manipulation and using the Dashboard Studio integrated into Splunk, you can achieve results like this.

Example of a complete dashboard

Click the image to enlarge.

In this example, I have included different types of charts and some input fields, such as choosing the environment based on the trigram that begins each of my namespaces (hence the importance of having a functional naming convention).

Conclusion

I hope that this article and the associated explanations have convinced you to invest, at least your time, in solutions like Splunk to provide better visibility within your Kubernetes clusters.

This is not just about collecting logs; it's also about being able to track a platform by combining events from different sources.

In this article, I only processed the logs from my cluster, but I could also add the logs from my firewalls, proxies, and operating systems. And work on tracing the entire lifecycle of a request, from its arrival at my first firewall to its processing on my web server.

Splunk is not the only tool that can help you with this type of task. Other applications, some of which are free, can provide similar services, such as ELK. You can even deploy other specialized components within the Kubernetes cluster, such as those related to CNI Cillium, to obtain information about communication between different pods.

Each person should choose their own tools. In my case, my work led me to use Splunk, which I find particularly effective and which benefits from many add-ons that offer increased compatibility with market standards.

In any case, I encourage you to prioritize solutions based on OpenTelemetry. This standard is constantly being adopted, and it will soon become indispensable in the coming years. I have not specifically detailed its use in this article. I simply deployed the Splunk agent based on OpenTelemetry within the K8S cluster, but this has already allowed me to address the topic. It is very likely that I will invest more in OpenTelemetry in the future.