Splunk Search

SPLUNK Query to combine two coloums as per the search string

bvsuman
New Member

Am using two Queries using appendcols to get the data . Sample data is as follows

Classification | Name | Basket1 |Basket2 | Basket1+2
Fruit | Mango | aa |xx |aaxx
Fruit | Apple |bb |yy |bbyy
Fruit | Banana |cc |zz | cczz
Fruit | Pineapple |dd |uu |dduu

In basket 1 sequence of fruits is Mango, Apple, Bananna, Pineapple whereas the sequence of Basket2 is Bananna( zz),Mango(uu), Apple(yy),pineapple(xx)

As per my requirement the result will be like below

Classification |Name| Basket1 | Basket2 | Basket1+2
Fruit |Mango|aa |uu |aauu
Fruit | Apple |bb|yy| bbyy
Fruit|Banana |cc |zz |cczz
Fruit|Pineapple| dd| xx|ddxx

Tags (1)
0 Karma

bvsuman
New Member

So please help me

0 Karma

bvsuman
New Member

sourcetype="st-offline-orders" NonContinuableError earliest=-48h@h latest=-24h@h |rex field=_raw "NonContinuableError:(?<NCE>.?)|DN" |search NCE NOT (:CON-* OR :CUST OR loginError) | eval Hour=strftime(_time, "%H") | chart count over NCE by Day | addtotals | sort 0 -Total |lookup local=true "FileName" NON_CONTINUABLE_ERROR as NCE OUTPUT CLASSIFICATION as Classification | where Classification="FRUIT" |table Classification NCE Total * | addcoltotals | rename "Total" as "Basket1" |appendcols [search sourcetype="st-online-orders" earliest=-48h@h latest=-24h@h NonContinuableError |rex field=_raw "NonContinuableError:(?<NCE>.?)|DN" |search NCE NOT (:CON-* OR :CUST OR loginError) | eval Hour=strftime(_time, "%H") | chart count over NCE by Day| addtotals | sort 0 -Total |lookup local=true "FileName1" NON_CONTINUABLE_ERROR as NCE OUTPUT CLASSIFICATION as Classification | where Classification="FRUIT" |table Classification NCE Total * | addcoltotals |rename "Total" as "Basket2"]| fields - NULL | eval Basket1+2=Basket1 + Basket2

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@bvsuman
Can you please share your both sample searches ??

0 Karma

bvsuman
New Member

sourcetype="st-offline-orders" NonContinuableError earliest=-48h@h latest=-24h@h |rex field=_raw "NonContinuableError:(?.?)|DN" |search NCE NOT (:CON- OR :CUST* OR loginError) | eval Hour=strftime(_time, "%H") | chart count over NCE by Day | addtotals | sort 0 -Total |lookup local=true "FileName" NON_CONTINUABLE_ERROR as NCE OUTPUT CLASSIFICATION as Classification | where Classification="FRUIT" |table Classification NCE Total | addcoltotals | rename "Total" as "Basket1" |appendcols [search sourcetype="st-online-orders" earliest=-48h@h latest=-24h@h NonContinuableError |rex field=_raw "NonContinuableError:(?.?)|DN" |search NCE NOT (:CON- OR :CUST OR loginError) | eval Hour=strftime(_time, "%H") | chart count over NCE by Day| addtotals | sort 0 -Total |lookup local=true "FileName1" NON_CONTINUABLE_ERROR as NCE OUTPUT CLASSIFICATION as Classification | where Classification="FRUIT" |table Classification NCE Total * | addcoltotals |rename "Total" as "Basket2"]| fields - NULL | eval Basket1+2=Basket1 + Basket2

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 ...