If you know all container names in advance, simply enumerate them. One way to do this is to use foreach.
index=* Initialised xxxxxxxxxxxx xxxxxx |rex "\{consumerName\=\'(MY REGEX)"
| stats count as Connections by Container_Name
| transpose header_field=Container_Name column_name=Container_Name
| foreach "Container A", "Container B", "Container C", "Container D"
[eval <<FIELD>> = if(isnull('<<FIELD>>'), "(missing)", '<<FIELD>>')]
| transpose header_field=Container_Name column_name=Container_Name
| addcoltotals fieldname=Connections labelfield=Container_Name
(If you perform stats on Container_Name,
For example, if your data is missing "Container D", you get
Container_Name | Connections |
Container A | 1 |
Container B | 1 |
Container C | 1 |
Container D | (missing) |
Total | 3 |
If your data is missing "Container C", you get
Container_Name | Connections |
Container A | 1 |
Container B | 1 |
Container D | 1 |
Container C | (missing) |
Total | 3 |
And so on.
Here is an emulation for you to play with and compare with real data
| makeresults
| fields - _time
| eval Container_Name = mvappend("Container A", "Container B"```, "Container C"```, "Container D")
``` data emulation above ```
Finding something that doesn't exist is not one of Splunk's strong suits! You can get around this by telling Splunk what to look for, for example
index=* Initialised xxxxxxxxxxxx xxxxxx|rex "\{consumerName\=\'(MY REGEX)"|chart count AS Connections by name
| append
[| makeresults format=csv data="name
Container A
Container B
Container C
Container D"]
| stats count by name
| where count < 2
Thank you, but when I run the suggestion provided on a time period I know would not return any result, nothing shows up. I expected it provide me the entire list in makeresults.
Sorry if I am missing something here or I don't understand your suggestion.
Which version of Splunk are you running as the format and data options to makeresults were introduced in version 9
I am afraid its on Version:8.2.11.2
That answers it.
Assume there is nothing else we can try on the version I am on please?
Best Regards
Try it like this (for pre-Splunk 9)
index=* Initialised xxxxxxxxxxxx xxxxxx|rex "\{consumerName\=\'(MY REGEX)"|chart count AS Connections by name
| append
[| makeresults
| eval name="Container A,Container B,Container C,Container D"
| eval name=split(name,",")]
| stats count by name
| where count < 2
I would also advise to externalise the conifg (the list of wanted containers) from the search itself.
So I'd simply create a lookup (let's call it containers.csv) with just one column called "name" containing all the containers you expect and then do
index=* Initialised xxxxxxxxxxxx xxxxxx|rex "\{consumerName\=\'(MY REGEX)"|chart count AS Connections by name
| append
[| inputlookup containers.csv ]
| stats count by name
| where count < 2
This way if your list of containers changes it's easy to just update the lookup instead of rewriting the search.