<?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 How to combine 2 csv files and perform multiple eval operations on it and produce a graph? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-2-csv-files-and-perform-multiple-eval-operations/m-p/314462#M94134</link>
    <description>&lt;P&gt;I have 2 CSV files. Each CSV file has 2 fields "Start_Time" and "End_Time"&lt;BR /&gt;
1. I need to find the "total time" taken i.e. sum of the difference between Start and End time for all the records. &lt;BR /&gt;
2. The total time for each CSV file is plotted against one another. &lt;/P&gt;

&lt;P&gt;How can this be achieved? &lt;BR /&gt;
I have tried to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="nfr-output_300_1.csv" host="IHTNW754752GG-L" index="main" sourcetype="csv"
 | join Seq_no, Ta_Id,objectID [search source="nfr-output_300_2.csv" host="IHTNW754752GG-L" index="main" sourcetype="csv" | rename Start_Time as Start_Time_openC, End_time as End_time_openC ]
 | eval end= strptime(End_time,"%Y-%m-%d %H:%M:%S")
 | eval start= strptime(Start_Time,"%Y-%m-%d %H:%M:%S")
 | eval diff= end-start
 | stats sum(diff) as Total_Time
 | eval Total_Time = Total_Time/3600

 | eval end1= strptime(End_time_openC,"%Y-%m-%d %H:%M:%S")
 | eval start1= strptime(Start_Time_openC,"%Y-%m-%d %H:%M:%S") 
 | eval diff1= end1-start1
 | stats sum(diff1) as Total_Time1
 | eval Total_Time1 = Total_Time1/3600
 | table Total_Time, Total_Time1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have joined the 2 files and repeated the same 'sum' calculations 2 times. It didnt work. &lt;BR /&gt;
Can someone help in achieving this problem? &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 17:42:30 GMT</pubDate>
    <dc:creator>harishy100</dc:creator>
    <dc:date>2020-09-29T17:42:30Z</dc:date>
    <item>
      <title>How to combine 2 csv files and perform multiple eval operations on it and produce a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-2-csv-files-and-perform-multiple-eval-operations/m-p/314462#M94134</link>
      <description>&lt;P&gt;I have 2 CSV files. Each CSV file has 2 fields "Start_Time" and "End_Time"&lt;BR /&gt;
1. I need to find the "total time" taken i.e. sum of the difference between Start and End time for all the records. &lt;BR /&gt;
2. The total time for each CSV file is plotted against one another. &lt;/P&gt;

&lt;P&gt;How can this be achieved? &lt;BR /&gt;
I have tried to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="nfr-output_300_1.csv" host="IHTNW754752GG-L" index="main" sourcetype="csv"
 | join Seq_no, Ta_Id,objectID [search source="nfr-output_300_2.csv" host="IHTNW754752GG-L" index="main" sourcetype="csv" | rename Start_Time as Start_Time_openC, End_time as End_time_openC ]
 | eval end= strptime(End_time,"%Y-%m-%d %H:%M:%S")
 | eval start= strptime(Start_Time,"%Y-%m-%d %H:%M:%S")
 | eval diff= end-start
 | stats sum(diff) as Total_Time
 | eval Total_Time = Total_Time/3600

 | eval end1= strptime(End_time_openC,"%Y-%m-%d %H:%M:%S")
 | eval start1= strptime(Start_Time_openC,"%Y-%m-%d %H:%M:%S") 
 | eval diff1= end1-start1
 | stats sum(diff1) as Total_Time1
 | eval Total_Time1 = Total_Time1/3600
 | table Total_Time, Total_Time1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have joined the 2 files and repeated the same 'sum' calculations 2 times. It didnt work. &lt;BR /&gt;
Can someone help in achieving this problem? &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:42:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-2-csv-files-and-perform-multiple-eval-operations/m-p/314462#M94134</guid>
      <dc:creator>harishy100</dc:creator>
      <dc:date>2020-09-29T17:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine 2 csv files and perform multiple eval operations on it and produce a graph?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-2-csv-files-and-perform-multiple-eval-operations/m-p/314463#M94135</link>
      <description>&lt;P&gt;hey you can try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" sourcetype="csv" source="nfr-output_300_1.csv" host="IHTNW754752GG-L" 
| eval end=strptime(End_time,"%Y-%m-%d %H:%M:%S") 
| eval start=strptime(Start_Time,"%Y-%m-%d %H:%M:%S") 
| eval diff=end-start 
| stats sum(diff) as Total_Time 
| eval Total_Time_csv1=round(Total_Time/3600) 
| fields- Total_Time 
| appendcols 
    [ search index="main" sourcetype="csv" source="nfr-output_300_2.csv" host="IHTNW754752GG-L" 
    | eval end=strptime(End_time,"%Y-%m-%d %H:%M:%S") 
    | eval start=strptime(Start_Time,"%Y-%m-%d %H:%M:%S") 
    | eval diff=end-start 
    | stats sum(diff) as Total_Time 
    | eval Total_Time_csv2=round(Total_Time/3600) 
    | fields- Total_Time]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 07:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-2-csv-files-and-perform-multiple-eval-operations/m-p/314463#M94135</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-23T07:16:14Z</dc:date>
    </item>
  </channel>
</rss>

