Hi there,
Can I know how to get the record from ver 1.1 by case sensitive excluding record from ver 1.2?
Currently I have data like this:
records:
============================================
index=a, ver=1.1, a="halo", b="haha", c="nana"
index=a, ver=1.1, a="testing", b="haha", c="nana"
index=a, ver=1.1, a="halo", b="kaka", c="testing"
index=a, ver=1.2, a="halo", b="haha", c="nana"
index=a, ver=1.2, a="lala", b="haha", c="nana"
index=a, ver=1.2, a="halo", b="kaka", c="TESTING"
============================================
Result expected:
index=a, ver=1.1, a="testing", b="haha", c="nana"
index=a, ver=1.1, a="halo", b="kaka", c="testing"
Is that possible to be done?
This is a run anywhere example using your data
| makeresults
| eval x="index=a, ver=1.1, a=\"halo\", b=\"haha\", c=\"nana\"##index=a, ver=1.1, a=\"testing\", b=\"haha\", c=\"nana\"##index=a, ver=1.1, a=\"halo\", b=\"kaka\", c=\"testing\"##index=a, ver=1.2, a=\"halo\", b=\"haha\", c=\"nana\"##index=a, ver=1.2, a=\"lala\", b=\"haha\", c=\"nana\"##index=a, ver=1.2, a=\"halo\", b=\"kaka\", c=\"TESTING\""
| makemv delim="##" x
| mvexpand x
| table x
| rename x as _raw
| extract
| fields - _raw
| stats values(ver) as ver by index a b c
| where ver="1.1" AND mvcount(ver)=1
The last two lines are the ones you want - and this is collapsing the versions for each of the index/a/b/c combinations and then just checking that ver only contains 1.1
Hope this helps
Hi bowesmana,
thank you for your answer, it works as expected.
However, I have pushed these records to Splunk database.
If I want to get the data from Splunk database and produce the same result, what query should I form?
The last two lines in that example were what you need to use in your query, obviously you will have to tweak the variable names according to your data if they are not as you have indicated.
This is a run anywhere example using your data
| makeresults
| eval x="index=a, ver=1.1, a=\"halo\", b=\"haha\", c=\"nana\"##index=a, ver=1.1, a=\"testing\", b=\"haha\", c=\"nana\"##index=a, ver=1.1, a=\"halo\", b=\"kaka\", c=\"testing\"##index=a, ver=1.2, a=\"halo\", b=\"haha\", c=\"nana\"##index=a, ver=1.2, a=\"lala\", b=\"haha\", c=\"nana\"##index=a, ver=1.2, a=\"halo\", b=\"kaka\", c=\"TESTING\""
| makemv delim="##" x
| mvexpand x
| table x
| rename x as _raw
| extract
| fields - _raw
| stats values(ver) as ver by index a b c
| where ver="1.1" AND mvcount(ver)=1
The last two lines are the ones you want - and this is collapsing the versions for each of the index/a/b/c combinations and then just checking that ver only contains 1.1
Hope this helps
Hi Bowesmana,
I understood now.
Thank you for your help.
The last two lines are what I needed:
| stats values(ver) as ver by index a b c
| where ver="1.1" AND mvcount(ver) = 1