Comparing values in two columns of two different Splunk searches

user2267886 picture user2267886 · Apr 10, 2013 · Viewed 14k times · Source

I am new to splunk and facing an issue in comparing values in two columns of two different queries.

Query 1

index="abc_ndx" source="*/jkdhgsdjk.log" call_id="**" A_to="**" A_from="**" | transaction call_id keepevicted=true | search "xyz event:" | table _time, call_id, A_from, A_to | rename call_id as Call_id, A_from as From, A_to as To

Query 2

index="abc_ndx" source="*/ jkdhgsdjk.log" call_id="**" B_to="**" B_from="**" | transaction call_id keepevicted=true | search " xyz event:"| table _time, call_id, B_from, B_to | rename call_id as Call_id, B_from as From, B_to as To

These are my two different queries. I want to compare each values in A_from column with each values in B_from column and if the value matches, then display the those values of A_from.

Is it possible?

I have run the two queries separately and exported the results of each into csv and used vlookup function. But the problem is there is a limit of max 10000 rows of data which can be exported and so I miss out lots of data as my data search has more than 10000 records. Any help?

Answer

MHibbin picture MHibbin · Apr 14, 2013

Haven't got any data to test this on at the moment, however, the following should point you in the right direction.

When you have the table for the first query sorted out, you should 'pipe' the search string to an appendcols command with your second search string. This command will allow you to run a subsearch and "import" a columns into you base search.

Once you have the two columns in the same table. You can use the eval command to create a new field which compares the two values and assigns a value as you desire.

Hope this helps.

http://docs.splunk.com/Documentation/Splunk/5.0.2/SearchReference/Appendcols http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval