<?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: Need _time on each event for a |makeresults in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348558#M103172</link>
    <description>&lt;P&gt;The mvexpand command doesn't work on &lt;CODE&gt;_*&lt;/CODE&gt; fields (internal/special splunk fields). Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval raw = "host1%UP%UP%UP%#host2%UP%UP%UP%#host3%UP%UP%UP%"
| makemv raw delim="#"
| mvexpand raw
| rex field=raw "(?P&amp;lt;host&amp;gt;[^\%]+)%(?P&amp;lt;Port1&amp;gt;[^\%]+)%(?P&amp;lt;Port2&amp;gt;[^\%]+)%(?P&amp;lt;Port3&amp;gt;[^\%]+)"
| table _time host Port1 Port2 Port3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 18 Dec 2017 18:34:16 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-12-18T18:34:16Z</dc:date>
    <item>
      <title>Need _time on each event for a |makeresults</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348556#M103170</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I need to spoof some data and am using |makeresults for 3 hosts and their port status of "UP" (and eventually "DOWN")&lt;/P&gt;

&lt;P&gt;| makeresults&lt;BR /&gt;
| eval _raw = "host1%UP%UP%UP%#host2%UP%UP%UP%#host3%UP%UP%UP%"&lt;BR /&gt;
| rex max_match=0 "(?P&amp;lt;_raw&amp;gt;[^#]+)"&lt;BR /&gt;
| mvexpand _raw&lt;BR /&gt;
| table _time _raw&lt;BR /&gt;
| rex "(?P[^\%]+)%(?P[^\%]+)%(?P[^\%]+)%(?P[^\%]+)"&lt;BR /&gt;
| table _time host Port1 Port2 Port3&lt;/P&gt;

&lt;P&gt;This gives me 3 lines for the result but _time shows only on the first result for "host1"&lt;/P&gt;

&lt;P&gt;Question: How do I get the above search show _time for the all 3 results?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:18:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348556#M103170</guid>
      <dc:creator>sbowser_splunk</dc:creator>
      <dc:date>2020-09-29T17:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need _time on each event for a |makeresults</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348557#M103171</link>
      <description>&lt;P&gt;answers were posted in the slack channel&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 18:32:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348557#M103171</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-12-18T18:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need _time on each event for a |makeresults</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348558#M103172</link>
      <description>&lt;P&gt;The mvexpand command doesn't work on &lt;CODE&gt;_*&lt;/CODE&gt; fields (internal/special splunk fields). Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval raw = "host1%UP%UP%UP%#host2%UP%UP%UP%#host3%UP%UP%UP%"
| makemv raw delim="#"
| mvexpand raw
| rex field=raw "(?P&amp;lt;host&amp;gt;[^\%]+)%(?P&amp;lt;Port1&amp;gt;[^\%]+)%(?P&amp;lt;Port2&amp;gt;[^\%]+)%(?P&amp;lt;Port3&amp;gt;[^\%]+)"
| table _time host Port1 Port2 Port3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Dec 2017 18:34:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348558#M103172</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-12-18T18:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need _time on each event for a |makeresults</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348559#M103173</link>
      <description>&lt;P&gt;okay, to give you three events, each with the _time, host, and one of the ports,  you can do either of these&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval myports=mvappend("Port1=".Port1."Port2=".Port2."Port3=".Port3) 
| table _time host myports 
| mvexpand myports 
| rex field=myports "(?&amp;lt;myport&amp;gt;[^=]+)=(?&amp;lt;myvalue&amp;gt;.*)$) 
| eval {myport} = myvalue 
| fields - myports myport myvalue 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This first one gives you a record that looks like &lt;CODE&gt;| table _time host Port*&lt;/CODE&gt; where Port* is either Port1, Port2 or Port3.&lt;/P&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats count as recno  
| rename _time as time 
| untable recno portname portvalue 
| eventstats min(eval(if(portname="time",portvalue)) as _time min(eval(if(portname="host",portvalue)) as host by recno 
| where portname!="time" AND portname!="host"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This second one gives a record that looks like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table _time host portname portvalue
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Dec 2017 18:38:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348559#M103173</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-12-18T18:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need _time on each event for a |makeresults</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348560#M103174</link>
      <description>&lt;P&gt;Thank you for all of these tips!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 19:08:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-time-on-each-event-for-a-makeresults/m-p/348560#M103174</guid>
      <dc:creator>sbowser_splunk</dc:creator>
      <dc:date>2017-12-18T19:08:17Z</dc:date>
    </item>
  </channel>
</rss>

