question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kubernetes logs in the "default" namespace have the namespace value "main"

See original GitHub issue

I’ve pinpointed where the issue is although I’m wary of making changes myself as I don’t know why the line was introduced in the first place. Skip to “Anything else we need to know?” for the root cause.

What happened: Kubernetes logs in the “default” namespace are being reported as being from the namespace “main” in Splunk.

What you expected to happen: Kubernetes logs in the “default” namespace should be reported as being from the “default” namespace in Splunk.

How to reproduce it (as minimally and precisely as possible):

  1. Set up SCK with a pod in the “default” namespace
  2. Look at the “namespace” field for the logs for that pod on Splunk

Anything else we need to know?: There was a commit to support index routing [1]. This added a feature where logs could be forwarded to an index with the same name as the log’s namespace. The default namespace for logs is “default”. The default index for Splunk is “main”. There was logic added to make sure logs from “default” namespace go into the “main” index [2]. However, in a separate file [3], the namespace field is also converted from “default” to “main”.

def set_namespace(value): if value == \"default\" then \"main\"else value end;

This seems very wrong as it breaks log correlation.

You can contact me over Slack as I am a Splunk employee.

[1] https://github.com/splunk/splunk-connect-for-kubernetes/commit/96df23c52c4af454d3671b92682f8dd8f8a03acc [2] https://github.com/splunk/splunk-connect-for-kubernetes/commit/96df23c52c4af454d3671b92682f8dd8f8a03acc#diff-dcb43995d0de88c51cf7a3d031a436dc [3] https://github.com/splunk/splunk-connect-for-kubernetes/blob/06e877daa21cff4420ededd069e20774e5b584d8/manifests/splunk-kubernetes-logging/configMap.yaml#L182

Environment:

  • Kubernetes version (use kubectl version): 1.13.4
  • OS (e.g: cat /etc/os-release): MacOS High Sierra
  • Splunk version: 7.3.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
hexecutecommented, Jul 26, 2019

“if you dont want the data from “default” namespace to route to “main” index” This isn’t about routing but data integrity. The logic for routing shouldn’t be modifying the logs data to achieve the desired behavior.

Your suggestion is a good workaround (indexRouting = false and indexRoutingDefaultIndex = default), and we’ll use that in our setup for now. I might create a PR in my spare time later.

0reactions
chaitanyaphalakcommented, Aug 6, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Namespaces - Kubernetes
In Kubernetes, namespaces provides a mechanism for isolating groups of resources within a single cluster. Names of resources need to be unique ...
Read more >
Namespaces Walkthrough | Kubernetes
You have a basic understanding of Kubernetes Pods, Services, and Deployments. Understand the default namespace. By default, a Kubernetes cluster ...
Read more >
kubectl Cheat Sheet | Kubernetes
Get commands with basic output kubectl get services # List all services in the namespace kubectl get pods --all-namespaces # List all pods ......
Read more >
Share a Cluster with Namespaces - Kubernetes
By default, a Kubernetes cluster will instantiate a default namespace when provisioning the cluster to hold the default set of Pods, Services, ...
Read more >
Logging Architecture | Kubernetes
By default, if a container restarts, the kubelet keeps one terminated container with its logs. If a pod is evicted from the node,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found