<?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: Please help in merge data in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Please-help-in-merge-data/m-p/313443#M4295</link>
    <description>&lt;P&gt;what do I need to do to get end time in the last event?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2017 23:56:42 GMT</pubDate>
    <dc:creator>sunitakesam</dc:creator>
    <dc:date>2017-02-22T23:56:42Z</dc:date>
    <item>
      <title>Please help in merge data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Please-help-in-merge-data/m-p/313440#M4292</link>
      <description>&lt;P&gt;pid script  host=dc1   "log= SUCCESS" OR "log= FAILURE" OR "log=Script "   |search  script =test1 OR&lt;BR /&gt;
script =test2 &lt;BR /&gt;
 | eval status=case( statusString=="exit", "success",  statusString=="terminated", "failed", &lt;BR /&gt;
 1=1, "Still in progress") &lt;BR /&gt;
  | eval JobName=case(script=="test1", "test1",&lt;BR /&gt;
 script=="test2", "test2",1=1, "unknown")&lt;BR /&gt;
 | eventstats min(_time) as start, max(_time) as end  by pid , script &lt;BR /&gt;
 | search status="success" OR status="failed" &lt;BR /&gt;
 | table pid, script,JobName, status, start, end,duration&lt;BR /&gt;
  |convert mktime(start) as start mktime(end) as end&lt;BR /&gt;
 |eval duration=tostring((end-start),"duration") | eval start=strftime(start, "%Y/%m/%d %T.%3Q") &lt;BR /&gt;
 | eval end=strftime(end, "%Y/%m/%d %T.%3Q") | sort by start desc &lt;/P&gt;

&lt;P&gt;script ended successfully&lt;BR /&gt;
  Date = 02/10/17 14:15:00,script = test1, id = 29251, log=Script started&lt;BR /&gt;
 2. Date = 02/10/17 14:15:00,script = test1, id = 29251, log=calling wget without post parameter&lt;BR /&gt;
 3. Date = 02/10/17 14:15:00,script = test1, id = 29251, log=wget command exit code: 0&lt;BR /&gt;
 4. Date = 02/10/17 14:15:00,script = test1, id = 29251, log=data invoked&lt;BR /&gt;
 5. Date = 02/10/17 14:15:00,script = test1, id = 29251, log=HTTP code from server:0&lt;BR /&gt;
 6. Date = 02/10/17 14:15:00,script = test1, id = 29251, log=Status will be updated in test.log&lt;BR /&gt;
 7. Date = 02/10/17 14:15:00,script = test1, id = 29251, log=&lt;BR /&gt;
 8. Date = 02/10/17 14:15:00,script = test1, id = 29251, log=Script exit normal&lt;/P&gt;

&lt;P&gt;Script still running&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Date = 02/10/17 14:15:00,script = test2, id = 29251, log=Script started&lt;/LI&gt;
&lt;LI&gt;Date = 02/10/17 14:15:00,script = test2, id = 29251, log=calling wget without post parameter&lt;/LI&gt;
&lt;LI&gt;Date = 02/10/17 14:15:00,script = test2, id = 29251, log=wget command exit code: 0&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Here statusString is extract feild value as 'started'/'exit notmal' i want to output as &lt;/P&gt;

&lt;P&gt;test1 success&lt;BR /&gt;
test2 still running&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:56:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Please-help-in-merge-data/m-p/313440#M4292</guid>
      <dc:creator>sunitakesam</dc:creator>
      <dc:date>2020-09-29T12:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in merge data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Please-help-in-merge-data/m-p/313441#M4293</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;pid script host=dc1 "log= SUCCESS" OR "log= FAILURE" OR "log=Script " script =test1 OR
script =test2 
| dedup script 
| eval Status=case( statusString=="exit", "success", statusString=="terminated", "failed", 
1=1, "Still in progress") 
| table script Status| rename script as JobName
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Feb 2017 20:59:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Please-help-in-merge-data/m-p/313441#M4293</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-02-21T20:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in merge data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Please-help-in-merge-data/m-p/313442#M4294</link>
      <description>&lt;P&gt;Explanation:&lt;BR /&gt;&lt;BR /&gt;
1) The dedup command, by default, will keep only the most recent record for each script.  (Technically, it keeps the first record found, and they are retrieved with the most-recent first.) That's all you need for current status.&lt;BR /&gt;
2) Your code has only two possible values for script, so there's no need for the case statement setting JobName.&lt;/P&gt;

&lt;P&gt;So, somesoni2's code is the simplest that will get you the status of those two jobs.&lt;/P&gt;

&lt;P&gt;If you wanted start time, end time, and so on, then more code (and actually a different method) would be needed.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 21:39:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Please-help-in-merge-data/m-p/313442#M4294</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-21T21:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in merge data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Please-help-in-merge-data/m-p/313443#M4295</link>
      <description>&lt;P&gt;what do I need to do to get end time in the last event?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 23:56:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Please-help-in-merge-data/m-p/313443#M4295</guid>
      <dc:creator>sunitakesam</dc:creator>
      <dc:date>2017-02-22T23:56:42Z</dc:date>
    </item>
  </channel>
</rss>

