This is an amazing find! My tests show that indeed, when a chain search needs a field that the base search does not pass, it will fail in mysterious ways. In most applications, the base search is n...
See more...
This is an amazing find! My tests show that indeed, when a chain search needs a field that the base search does not pass, it will fail in mysterious ways. In most applications, the base search is not as vanilla as index=abcd, so this behavior would not be revealed. But I consider this a bug because even if the requirement that base search must contain provisions to pass fields used by all chain searches is carefully documented, it is really counterintuitive for users and a slip can affect results in subtle ways that users may end up trusting bad data. Good news is that DS team is aggressively trying to relieve user friction. Bad news is that this is a rather tricky one so I don't expect speedy fix even if they accept it as a bug. Here is the gist of the problem/behavior: To improve performance, SPL compiler will decide which field(s) to pass through a pipe by inspecting downstream searches. Because base search and chain search are completely separate as far as compiler is concerned, only indexed fields and explicitly invoked fields in the base search will be passed to chain searches. In your example, base search index=_internal will only pass _time, sourcetype, source, host, etc. All search-time fields are omitted. When you change base search to index=_internal useTypeahead=true, the compiler sees that useTypeahead is referenced, therefore it passes this to result cache. Here is a simpler test dashboard to demonstrate: (I use date_hour because it is 100% populated) {
"visualizations": {
"viz_AD6BWNHC": {
"type": "splunk.events",
"dataSources": {
"primary": "ds_4EfZYMc8"
},
"title": "base1",
"description": "index=_internal",
"showProgressBar": false,
"showLastUpdated": false
},
"viz_TrPHlPsH": {
"type": "splunk.events",
"dataSources": {
"primary": "ds_561TjAWf"
},
"showProgressBar": false,
"showLastUpdated": false,
"title": "base1 | table date_hour sourcetype _time",
"description": "(bad)"
},
"viz_SiLJUCQc": {
"type": "splunk.events",
"dataSources": {
"primary": "ds_FmGTHy8w"
},
"title": "base2",
"description": "index=_internal date_hour=*"
},
"viz_A0PjYfHd": {
"type": "splunk.events",
"dataSources": {
"primary": "ds_feUCBRcX"
},
"title": "base2 | table date_second sourcetype _time",
"description": "(good)"
}
},
"dataSources": {
"ds_4EfZYMc8": {
"type": "ds.search",
"options": {
"query": "index=_internal",
"queryParameters": {
"earliest": "-4h@m",
"latest": "now"
}
},
"name": "base1"
},
"ds_561TjAWf": {
"type": "ds.chain",
"options": {
"extend": "ds_4EfZYMc8",
"query": "| table date_hour sourcetype _time"
},
"name": "chain"
},
"ds_FmGTHy8w": {
"type": "ds.search",
"options": {
"query": "index=_internal date_hour=*",
"queryParameters": {
"earliest": "-4h@m",
"latest": "now"
}
},
"name": "base2"
},
"ds_feUCBRcX": {
"type": "ds.chain",
"options": {
"extend": "ds_FmGTHy8w",
"query": "| table date_hour sourcetype _time"
},
"name": "chain1a"
}
},
"defaults": {
"dataSources": {
"ds.search": {
"options": {
"queryParameters": {
"latest": "$global_time.latest$",
"earliest": "$global_time.earliest$"
}
}
}
}
},
"inputs": {},
"layout": {
"type": "grid",
"options": {
"width": 1440,
"height": 960
},
"structure": [
{
"item": "viz_AD6BWNHC",
"type": "block",
"position": {
"x": 0,
"y": 0,
"w": 720,
"h": 307
}
},
{
"item": "viz_TrPHlPsH",
"type": "block",
"position": {
"x": 0,
"y": 307,
"w": 720,
"h": 266
}
},
{
"item": "viz_SiLJUCQc",
"type": "block",
"position": {
"x": 720,
"y": 0,
"w": 720,
"h": 307
}
},
{
"item": "viz_A0PjYfHd",
"type": "block",
"position": {
"x": 720,
"y": 307,
"w": 720,
"h": 266
}
}
],
"globalInputs": []
},
"description": "https://community.splunk.com/t5/Splunk-Search/Do-you-lose-any-information-between-Chain-Searches-in-Dashboards/m-p/671245#M230046",
"title": "Chain search lose info test fresh"
} This is the result: Here, date_hour is null in the chain search using index=_internal as base search. One recommendation about your workaround: If your base search uses index=_internal useTypeahead=true instead of index=_internal | useTypeahead=true, the indexer will return a lot fewer events, and the search will be much more efficient. As to the bug/behavior, because the cause is inherent to the compiler, I imagine it to be really difficult for a high-level application like a dashboard engine to influence. Nevertheless, I trust that the DS team will be grateful that you discovered this problem.