Splunk Search

What's wrong with query not getting data?

nikhil29
Loves-to-Learn Everything

could someone please let me know where I'm going wrong in my query ?

| spath service_roles{} output=service_role
| stats count by cluster_name date service_role
| spath input=service_role service output=service_name
| spath input=service_role role_status{} output=status
| rex max_match=0 field=_raw "hostname: <(?<hostname>.*)> type: <(?<type>.*)>"
| eval status=mvzip(hostname,type)
| mvexpand status
| rex field=status "(?<hostname>[^~]+)~(?<type>[^~]+)"
| dedup cluster_name, service_name
| table cluster_name, service_name, hostname, type


2023-01-05_19h44_04.png

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Your example data doesn't match your search. But as a general rule - there are two techniques of debugging searches.

1. Remove last command and see if the results match what you expect. If not, remove another one. And so on until you agree with the output

2. Start from the beginning - do the base search and one by one add commands and verify if the output matches your expectations.

nikhil29
Loves-to-Learn Everything

please follow my sample data here for above issue

{"hostname": "***", "status": "NA", "type": "GATEWAY", "role_url": "***"}
{"hostname": "***", "status": "STARTED", "type": "HDFS", "role_url": "***"}
{"hostname": "***", "status": "MAINTENANCE_MODE", "type": "Zookeeper", "role_url": "***"}
{"hostname": "***", "status": "MAINTENANCE_MODE", "type": "YARN", "role_url": "***"}



0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...