<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Take sample events in an index from a CSV file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624710#M217167</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230393"&gt;@phamxuantung&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if you have the csv in a lookup, you can use the lookup command, something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index
| lookup your_lookup.csv PAN
| table PAN total_trans total_amount HASHPAN _time TRACE TRANSACTIONID&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;if instead the csv is in another index, in general you have to find a unique Correlation Key (e.g.:&amp;nbsp;PAN or HASHPAN) and use it to correlate data using the stats command,&amp;nbsp; something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index1 OR index=index2
| stats 
   values(total_trans) AS total_trans
   values(total_amount) AS total_amount
   values(HASHPAN) AS HASHPAN
   earliest(_time) AS _time
   values(TRACE) AS TRACE
   values(TRANSACTIONID) AS TRANSACTIONID
   BY PAN&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2022 11:06:25 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-12-19T11:06:25Z</dc:date>
    <item>
      <title>How to take sample events in an index from a CSV file?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624708#M217165</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a csv file that have some summary stats from an index, but the requirement&amp;nbsp; is to show an sample event with all the info in that index.&lt;/P&gt;
&lt;P&gt;The CSV file have a hash number (from a account number), some calculated status. For example:&lt;/P&gt;
&lt;TABLE border="1" width="100.00000685711245%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;PAN&lt;/TD&gt;
&lt;TD width="25%"&gt;total_trans&lt;/TD&gt;
&lt;TD width="12.5%"&gt;total_amount&lt;/TD&gt;
&lt;TD width="12.5%"&gt;HASHPAN&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;1234******5678&lt;/TD&gt;
&lt;TD width="25%"&gt;15&lt;/TD&gt;
&lt;TD width="12.5%"&gt;15000&lt;/TD&gt;
&lt;TD width="12.5%"&gt;ABC123&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The index have all the transaction and detail. We need to take an sample in the index from the csv and output to a new csv that have sample detail. Something like this:&lt;/P&gt;
&lt;TABLE border="1" width="108.33333333333334%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;PAN&lt;/TD&gt;
&lt;TD width="25%"&gt;total_trans&lt;/TD&gt;
&lt;TD width="12.5%"&gt;total_amount&lt;/TD&gt;
&lt;TD width="12.5%"&gt;HASHPAN&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;_time&lt;/TD&gt;
&lt;TD width="8.333333333333334%"&gt;TRACE&lt;/TD&gt;
&lt;TD width="8.333333333333334%"&gt;TRANSACTIONID&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%"&gt;1234******5678&lt;/TD&gt;
&lt;TD width="25%"&gt;15&lt;/TD&gt;
&lt;TD width="12.5%"&gt;15000&lt;/TD&gt;
&lt;TD width="12.5%"&gt;ABC123&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;xxxxxxx&lt;/TD&gt;
&lt;TD width="8.333333333333334%"&gt;xxxxxx&lt;/TD&gt;
&lt;TD width="8.333333333333334%"&gt;xxxxxxxxx&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't really like to use join, because the index have a lot of events (around 32 mils events). Are there any elegants way to get the data?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 15:53:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624708#M217165</guid>
      <dc:creator>phamxuantung</dc:creator>
      <dc:date>2022-12-19T15:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Take sample events in an index from a CSV file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624710#M217167</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230393"&gt;@phamxuantung&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if you have the csv in a lookup, you can use the lookup command, something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index
| lookup your_lookup.csv PAN
| table PAN total_trans total_amount HASHPAN _time TRACE TRANSACTIONID&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;if instead the csv is in another index, in general you have to find a unique Correlation Key (e.g.:&amp;nbsp;PAN or HASHPAN) and use it to correlate data using the stats command,&amp;nbsp; something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index1 OR index=index2
| stats 
   values(total_trans) AS total_trans
   values(total_amount) AS total_amount
   values(HASHPAN) AS HASHPAN
   earliest(_time) AS _time
   values(TRACE) AS TRACE
   values(TRANSACTIONID) AS TRANSACTIONID
   BY PAN&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 11:06:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624710#M217167</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-12-19T11:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Take sample events in an index from a CSV file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624711#M217168</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230393"&gt;@phamxuantung&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I understand well, your requirement is to join data from index and csv lookup without using Join command. If yes then try the below query&lt;/P&gt;&lt;P&gt;index=test_index&lt;BR /&gt;| lookup transactions.csv common_field OUTPUT total_amount total_trans&lt;/P&gt;&lt;P&gt;In the output you can specify all the required fields from the lookup.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Manasa&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 11:08:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624711#M217168</guid>
      <dc:creator>Manasa_401</dc:creator>
      <dc:date>2022-12-19T11:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: Take sample events in an index from a CSV file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624778#M217192</link>
      <description>&lt;P&gt;Accroding to my understanding, if you specify the index first and |lookup the csv, the addition information will populate on all the events in the index (in my case, all the events that have the same HASHPAN), is it not?&lt;/P&gt;&lt;P&gt;But I want the opposite. The csv hold, for example, 50 uniques HASHPAN, and I want to take sample events of that HASHPAN in the index (first 50 or last 50 events that have that HASHPAN, base on which is faster).&lt;/P&gt;&lt;P&gt;My code for my intergration is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|inputlookup mycsv.csv
|join HASHPAN 
[search index=myindex
|dedup HASHPAN
]
|table &amp;lt;detail fields that I need&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;looking at this, I think you'll understand what I mean, but I want a more "efficient" waty to doing this.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 02:14:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624778#M217192</guid>
      <dc:creator>phamxuantung</dc:creator>
      <dc:date>2022-12-20T02:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Take sample events in an index from a CSV file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624795#M217198</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230393"&gt;@phamxuantung&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;in other words, you want to filter (find) events in the index that match the values of the csv, if this is your need, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex [ | inputlookup mycsv.csv | fields HASHPAN ]
| lookup your_lookup.csv HASHPAN 
| table PAN total_trans total_amount HASHPAN _time TRACE TRANSACTIONID&lt;/LI-CODE&gt;&lt;P&gt;otherwise, if you're sure that a field of the lookup (e.g. PAN) has always values, you could also use a simpler solution:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index
| lookup your_lookup.csv HASHPAN OUTPUTNEW PAN total_trans total_amount
| where PAN=*
| table PAN total_trans total_amount HASHPAN _time TRACE TRANSACTIONID&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 07:39:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-take-sample-events-in-an-index-from-a-CSV-file/m-p/624795#M217198</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-12-20T07:39:20Z</dc:date>
    </item>
  </channel>
</rss>

