<?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: data mapping in csv file during splunk search in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114696#M23985</link>
    <description>&lt;P&gt;HI,&lt;/P&gt;

&lt;P&gt;The solution will be much simpler if you can get the access to raw logs. In case, its not possible, you can try following approach.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup Data.csv | eval customField=[| inputlookup Data.csv | table time,busycore,cpu0,cpu1,cpu2 | fields - time busycore | transpose | fields column| eval customField = "\"".column."=\".".column.".\"~\"." | stats values(customField) as QueryValues | makemv delim="||" QueryValues | eval QueryFilter = substr(QueryValues , 1, len(QueryValues)-5) | return $QueryFilter] | makemv delim="~" customField | fields time busycore customField | mvexpand customField | eval customField = split(customField ,"=") | eval cpuName = mvindex(customField, 0) | eval cpuUsage=mvindex(customField, 1) | eventstats max(cpuUsage) as maxUsageByTime by time | eval maxCheck=if(cpuUsage==maxUsageByTime,"Yes","NO")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is an explanation:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Load the data : *&lt;EM&gt;| inputlookup Data.csv *&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;Dynamically construct a customField which will have value like &lt;STRONG&gt;"cpu0=".cpu0."~". "cpu1=".cpu1."~". "cpu2=".cpu2&lt;/STRONG&gt;. This value will change depending on the number of CPU information you have in the data. The subsearch dynamically construct the string similar to above string.&lt;/LI&gt;
&lt;LI&gt;Rearrange the data as multiple events so that stats function can be used. All the events with &lt;STRONG&gt;maxCheck=Yes&lt;/STRONG&gt; are the maximum value for that time.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
    <pubDate>Wed, 20 May 2015 11:49:33 GMT</pubDate>
    <dc:creator>vganjare</dc:creator>
    <dc:date>2015-05-20T11:49:33Z</dc:date>
    <item>
      <title>data mapping in csv file during splunk search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114695#M23984</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a csv file, and i don't have access to raw data. csv file is created by some other software.&lt;BR /&gt;
its structure is like:&lt;/P&gt;

&lt;P&gt;time               busycore         cpu0         cpu1         cpu2&lt;BR /&gt;
01:20:30          1                       20%           50%         10%&lt;BR /&gt;
01:28:30          0                       80%           30%         40%&lt;BR /&gt;
01:30:25          1                       40%           90%         30%&lt;/P&gt;

&lt;P&gt;i have to plot a graph showing at which time which cpu was busiest one and the value of that cpu.&lt;BR /&gt;
for example at 01:20:30  busycore is 1 means cpu1 was busiest and it was used by 50%.&lt;BR /&gt;
graph should show at 01:20:30 cpu1 was busiest and used by 50%.&lt;BR /&gt;
any graph is ok with me. it can be bubble or scatter anything.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 08:49:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114695#M23984</guid>
      <dc:creator>ektasiwani</dc:creator>
      <dc:date>2015-05-20T08:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: data mapping in csv file during splunk search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114696#M23985</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;

&lt;P&gt;The solution will be much simpler if you can get the access to raw logs. In case, its not possible, you can try following approach.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup Data.csv | eval customField=[| inputlookup Data.csv | table time,busycore,cpu0,cpu1,cpu2 | fields - time busycore | transpose | fields column| eval customField = "\"".column."=\".".column.".\"~\"." | stats values(customField) as QueryValues | makemv delim="||" QueryValues | eval QueryFilter = substr(QueryValues , 1, len(QueryValues)-5) | return $QueryFilter] | makemv delim="~" customField | fields time busycore customField | mvexpand customField | eval customField = split(customField ,"=") | eval cpuName = mvindex(customField, 0) | eval cpuUsage=mvindex(customField, 1) | eventstats max(cpuUsage) as maxUsageByTime by time | eval maxCheck=if(cpuUsage==maxUsageByTime,"Yes","NO")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is an explanation:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Load the data : *&lt;EM&gt;| inputlookup Data.csv *&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;Dynamically construct a customField which will have value like &lt;STRONG&gt;"cpu0=".cpu0."~". "cpu1=".cpu1."~". "cpu2=".cpu2&lt;/STRONG&gt;. This value will change depending on the number of CPU information you have in the data. The subsearch dynamically construct the string similar to above string.&lt;/LI&gt;
&lt;LI&gt;Rearrange the data as multiple events so that stats function can be used. All the events with &lt;STRONG&gt;maxCheck=Yes&lt;/STRONG&gt; are the maximum value for that time.&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 11:49:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114696#M23985</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-05-20T11:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: data mapping in csv file during splunk search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114697#M23986</link>
      <description>&lt;P&gt;Can you try using following query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup Data.csv | eval customField=[| inputlookup Data.csv | fields - time busycore | transpose | fields column| eval customField = "\"".column."=\".".column.".\"~\"." | stats values(customField) as QueryValues | makemv delim="||" QueryValues | eval QueryFilter = substr(QueryValues , 1, len(QueryValues)-5) | return $QueryFilter] | makemv delim="~" customField | fields time busycore customField | mvexpand customField | eval customField = split(customField ,"=") | eval cpuName = mvindex(customField, 0) | eval cpuUsage=mvindex(customField, 1) | eventstats max(cpuUsage) as maxUsageByTime by time | eval maxCheck=if(cpuUsage==maxUsageByTime,"Yes","NO")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 12:29:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114697#M23986</guid>
      <dc:creator>vganjare</dc:creator>
      <dc:date>2015-05-20T12:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: data mapping in csv file during splunk search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114698#M23987</link>
      <description>&lt;P&gt;Sorry my mistake, now i am getting output. but for single time i am getting 4 entry , 3 entry showing 'no'  and one entry showing ' yes'.&lt;BR /&gt;
I want to remove  all three "no" entries. &lt;BR /&gt;
Can we use if condition to do that. &lt;BR /&gt;
 i mean just check busycore value and then match it with last digit of cpu0,cpu1 and cpu2.&lt;BR /&gt;
if both are same keep data else ignore.&lt;/P&gt;

&lt;P&gt;Thanks ..:)&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 18:35:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114698#M23987</guid>
      <dc:creator>ektasiwani</dc:creator>
      <dc:date>2015-05-20T18:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: data mapping in csv file during splunk search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114699#M23988</link>
      <description>&lt;P&gt;I did same using where. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 18:37:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114699#M23988</guid>
      <dc:creator>ektasiwani</dc:creator>
      <dc:date>2015-05-20T18:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: data mapping in csv file during splunk search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114700#M23989</link>
      <description>&lt;P&gt;Hi @ektasiwani&lt;/P&gt;

&lt;P&gt;Please be sure that when responding to someone's answer, click on "Add comment" directly below their answer or, if responding to someone's comment, type in the "Add your comment..." box directly below their comment. You keeping typing your response in the "Enter your answer here..." box at the very bottom of the page which, instead, posts a brand new answer when it was really meant as a comment. This will help with a clean continuous flow of the conversation. Right now, it's hard to tell who you your responses were intended for. In addition, unless the user is following the question, they won't get a notification that you posted something new. Just something to keep in mind from here on out.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2015 01:51:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114700#M23989</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2015-05-21T01:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: data mapping in csv file during splunk search</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114701#M23990</link>
      <description>&lt;P&gt;oopss sorry.&lt;BR /&gt;
I will take care of that.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2015 05:07:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/data-mapping-in-csv-file-during-splunk-search/m-p/114701#M23990</guid>
      <dc:creator>ektasiwani</dc:creator>
      <dc:date>2015-05-21T05:07:28Z</dc:date>
    </item>
  </channel>
</rss>

