Splunk Search

Splunk query to get top sorcetypename=kubernetes_logs, devided by services (or namespaces)

alekseisaiko
Path Finder

Hi there!
I need a query, that will show me Top Sourcetype Sizes by Day, where sourcetype=kubernetes_logs, and the kubernetes_logs itself, to divide by service names (or namespace names).
RIght now, I'm using this query -

index=_internal source=*license_usage.log type="Usage"
| eval indexname = if(len(idx)=0 OR isnull(idx),"(UNKNOWN)",idx)
| eval sourcetypename = st
| bin _time span=1d
| stats sum(b) as b by _time, pool, indexname, sourcetypename
| eval GB=round(b/1024/1024/1024, 3)
| fields _time, indexname, sourcetypename, GB
| sort by GB
| reverse

But how do I exclude only kubernetes_logs from here, and divide it by service names?

Thanks!

0 Karma
1 Solution

alekseisaiko
Path Finder
0 Karma

alekseisaiko
Path Finder

Solved it

0 Karma

alekseisaiko
Path Finder

Or maybe source must be used instead of sourcetypename? For example “kube:container"? But still I have no success to pull the container logs

0 Karma

to4kawa
Ultra Champion

sample of results please.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...