<?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: Subsearch map command doesn't work in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472717#M133034</link>
    <description>&lt;P&gt;strange query, isn't it?&lt;BR /&gt;
If you provide sample logs, I make query.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Apr 2020 10:12:54 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-04-15T10:12:54Z</dc:date>
    <item>
      <title>Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472711#M133028</link>
      <description>&lt;P&gt;I have a query that uses map and subsearch inside map command as below:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;host="X"  booking  source="Y" Success &lt;BR /&gt;
| dedup ID&lt;BR /&gt;
| table  ID&lt;BR /&gt;
| &lt;BR /&gt;
map maxsearches=10 search="search host="X" source="Y" $ID$&lt;BR /&gt;
|&lt;BR /&gt;
stats range(_time) as "booking time"|table ID "booking time""&lt;/EM&gt;* &lt;/P&gt;

&lt;P&gt;I'm trying to get ID field from main search and run map subsearch with variable ID field. In main search I'm looking for events with success and parse IDs. In subsearch i'm trying to eval time between first and last occurrence of ID field.&lt;BR /&gt;
I expect to have results in table format like below:&lt;/P&gt;

&lt;P&gt;ID   "booking time"&lt;BR /&gt;
3345 867.34&lt;BR /&gt;
2245 665.7&lt;BR /&gt;
etc. &lt;/P&gt;

&lt;P&gt;but I failed.&lt;/P&gt;

&lt;P&gt;What I'm doing wrong?&lt;BR /&gt;
Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 09:19:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472711#M133028</guid>
      <dc:creator>slipinski</dc:creator>
      <dc:date>2020-04-15T09:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472712#M133029</link>
      <description>&lt;P&gt;use &lt;CODE&gt;by&lt;/CODE&gt; clause in subsearch&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 09:23:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472712#M133029</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-15T09:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472713#M133030</link>
      <description>&lt;P&gt;Do you mean &lt;BR /&gt;
&lt;EM&gt;stats range(_time) as "booking time" by ID&lt;/EM&gt; ?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 09:32:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472713#M133030</guid>
      <dc:creator>slipinski</dc:creator>
      <dc:date>2020-04-15T09:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472714#M133031</link>
      <description>&lt;P&gt;What's &lt;CODE&gt;bookingID&lt;/CODE&gt;?&lt;BR /&gt;
just &lt;CODE&gt;ID&lt;/CODE&gt; isn't it?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...
| table ID "booking time"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this is your query.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 09:37:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472714#M133031</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-15T09:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472715#M133032</link>
      <description>&lt;P&gt;@slipinski &lt;/P&gt;

&lt;P&gt;Yes do like that &lt;CODE&gt;stats range(_time) as "booking time" by ID ?&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;or go with &lt;STRONG&gt;Join&lt;/STRONG&gt; command &lt;STRONG&gt;Join Id&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 09:44:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472715#M133032</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2020-04-15T09:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472716#M133033</link>
      <description>&lt;P&gt;Thanks. It works fine with map search like below&lt;BR /&gt;
&lt;EM&gt;map maxsearches=10 search="search host="X" source="Y" $ID$&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;but if I elaborate this query with more filters like&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;map maxsearches=10 search="search host=X" source="Y"   ("\ncreations" OR "new contributors: Set(book.$ID$&lt;/EM&gt;)") AND $ID$ NOT "\ncancellations:&lt;EM&gt;$ID$&lt;/EM&gt;" "* &lt;/P&gt;

&lt;P&gt;it doesn't. I works of course if running a separate search with static parameter instead of variable $ID$. Do I need any special characters as I'm using * as argument for "any" and "\" symbol in search?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 10:08:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472716#M133033</guid>
      <dc:creator>slipinski</dc:creator>
      <dc:date>2020-04-15T10:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472717#M133034</link>
      <description>&lt;P&gt;strange query, isn't it?&lt;BR /&gt;
If you provide sample logs, I make query.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 10:12:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472717#M133034</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-15T10:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472718#M133035</link>
      <description>&lt;P&gt;Yes, it is &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;
 I've created the query to compare time of  first and last events (\ncreations and Config success) accordingly related to particular connection  1236363. I don't want to have ncancellations1236363 in this comparison, that's why I'm using "\ncancellations:$ID$ statement in the query&lt;/P&gt;

&lt;P&gt;"2020-04-15 12:17:17,046 backend_7.2.15: INFO     services/ConnectionManagerService(backend): \ncreations:     \nupdates:       \ncancellations: 1236363-1"&lt;BR /&gt;
"2020-04-15 11:49:23,844 backend_7.2.15: INFO     services/ConfigurationManagerService(backend): Successfully applied config for 10.51.128.132.1.90000/igmpPortConfig! (Config success!). New contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)."&lt;BR /&gt;
"2020-04-15 11:49:23,800 backend_7.2.15: INFO     services/ConfigurationManagerService(backend): Successfully applied config for 10.51.128.142.SwitchingCore/openflowConfig! (Config success!). New contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)."&lt;BR /&gt;
"2020-04-15 11:49:23,753 backend_7.2.15: INFO     services/ConfigurationManagerService(backend): &lt;A href="mailto:ControlledVertexFSM@10.51.128.132.SwitchingCore" target="_blank"&gt;ControlledVertexFSM@10.51.128.132.SwitchingCore&lt;/A&gt;/rpfPortConfig: New config retrieved by Root state with delay None, new contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)"&lt;BR /&gt;
"2020-04-15 11:49:23,751 backend_7.2.15: INFO     services/ConfigurationManagerService(backend): &lt;A href="mailto:ControlledVertexFSM@10.51.128.140.SwitchingCore" target="_blank"&gt;ControlledVertexFSM@10.51.128.140.SwitchingCore&lt;/A&gt;/openflowConfig: New config retrieved by Root state with delay None, new contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)"&lt;BR /&gt;
"2020-04-15 11:49:23,749 backend_7.2.15: INFO     services/ConfigurationManagerService(backend): &lt;A href="mailto:ControlledVertexFSM@10.51.128.132.1.90000" target="_blank"&gt;ControlledVertexFSM@10.51.128.132.1.90000&lt;/A&gt;/igmpPortConfig: New config retrieved by Root state with delay None, new contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)"&lt;BR /&gt;
"2020-04-15 11:49:23,749 backend_7.2.15: INFO     services/ConfigurationManagerService(backend): &lt;A href="mailto:ControlledVertexFSM@10.51.128.142.SwitchingCore" target="_blank"&gt;ControlledVertexFSM@10.51.128.142.SwitchingCore&lt;/A&gt;/openflowConfig: New config retrieved by Root state with delay None, new contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)"&lt;BR /&gt;
"2020-04-15 11:49:23,696 backend_7.2.15: INFO     services/VirtualRoutingService(backend): Crosspoints changed: l78: 114 -&amp;gt; 35 (booking = 1236363-1)), l0: 114 -&amp;gt; 35 (booking = 1236363-1)), "&lt;BR /&gt;
Show syntax highlighted&lt;BR /&gt;
"2020-04-15 11:49:23,686 backend_7.2.15: INFO     services/RedundancyControllerService(backend): redctl-1236363-1: Controller is started for booking with gpid = 100:book.1236363-1"&lt;BR /&gt;
"2020-04-15 11:49:23,680 backend_7.2.15: INFO     services/PathManagerService(backend): Booking 1236363-1(p2mp_join): 10.51.128.80.1.90202 -&amp;gt; 10.51.128.75.1.1000203 Success"&lt;BR /&gt;
Show syntax highlighted&lt;BR /&gt;
"2020-04-15 11:49:23,541 backend_7.2.15: INFO     services/PathManagerService(backend): Update service&lt;A href="https://community.splunk.com/p2mp_join" target="_blank"&gt;1236363-1&lt;/A&gt;: &amp;lt;10.51.128.80.1.90202&amp;gt; =&amp;gt; &amp;lt;10.51.128.75.1.1000203&amp;gt;  2020-04-15T11:49:23.538+02:00 -&amp;gt; 2038-01-19T04:14:07.000+01:00"&lt;BR /&gt;
"2020-04-15 11:49:23,538 backend_7.2.15: INFO     services/ConnectionManagerService(backend): \ncreations:     1236363\nupdates:       \ncancellations: 1235337-1"&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:57:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472718#M133035</guid>
      <dc:creator>slipinski</dc:creator>
      <dc:date>2020-09-30T04:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472719#M133036</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="raw
2020-04-15 12:17:17,046 backend_7.2.15: INFO services/ConnectionManagerService(backend): \ncreations: \nupdates: \ncancellations: 1236363-1
2020-04-15 11:49:23,844 backend_7.2.15: INFO services/ConfigurationManagerService(backend): Successfully applied config for 10.51.128.132.1.90000/igmpPortConfig! (Config success!). New contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1).
2020-04-15 11:49:23,800 backend_7.2.15: INFO services/ConfigurationManagerService(backend): Successfully applied config for 10.51.128.142.SwitchingCore/openflowConfig! (Config success!). New contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1).
2020-04-15 11:49:23,753 backend_7.2.15: INFO services/ConfigurationManagerService(backend): ControlledVertexFSM@10.51.128.132.SwitchingCore/rpfPortConfig: New config retrieved by Root state with delay None, new contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)
2020-04-15 11:49:23,751 backend_7.2.15: INFO services/ConfigurationManagerService(backend): ControlledVertexFSM@10.51.128.140.SwitchingCore/openflowConfig: New config retrieved by Root state with delay None, new contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)
2020-04-15 11:49:23,749 backend_7.2.15: INFO services/ConfigurationManagerService(backend): ControlledVertexFSM@10.51.128.132.1.90000/igmpPortConfig: New config retrieved by Root state with delay None, new contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)
2020-04-15 11:49:23,749 backend_7.2.15: INFO services/ConfigurationManagerService(backend): ControlledVertexFSM@10.51.128.142.SwitchingCore/openflowConfig: New config retrieved by Root state with delay None, new contributors: Set(book.1236363-1), removed contributors: Set(book.1235337-1)
2020-04-15 11:49:23,696 backend_7.2.15: INFO services/VirtualRoutingService(backend): Crosspoints changed: l78: 114 -&amp;gt; 35 (booking = 1236363-1)), l0: 114 -&amp;gt; 35 (booking = 1236363-1)), 
Show syntax highlighted
2020-04-15 11:49:23,686 backend_7.2.15: INFO services/RedundancyControllerService(backend): redctl-1236363-1: Controller is started for booking with gpid = 100:book.1236363-1
2020-04-15 11:49:23,680 backend_7.2.15: INFO services/PathManagerService(backend): Booking 1236363-1(p2mp_join): 10.51.128.80.1.90202 -&amp;gt; 10.51.128.75.1.1000203 Success
Show syntax highlighted
2020-04-15 11:49:23,541 backend_7.2.15: INFO services/PathManagerService(backend): Update service[1236363-1] (p2mp_join): &amp;lt;10.51.128.80.1.90202&amp;gt; =&amp;gt; &amp;lt;10.51.128.75.1.1000203&amp;gt; 2020-04-15T11:49:23.538+02:00 -&amp;gt; 2038-01-19T04:14:07.000+01:00
2020-04-15 11:49:23,538 backend_7.2.15: INFO services/ConnectionManagerService(backend): \ncreations: 1236363\nupdates: \ncancellations: 1235337-1"
| multikv noheader=t
| rex "(?&amp;lt;ID&amp;gt;\d{7})"
| rex "(?&amp;lt;time&amp;gt;^.*?,\d{3})"
| eval _time=strptime(time,"%F %T,%3Q")
| rename COMMENT as "this is sample. from here, the logic"

| reverse
| streamstats count(eval(searchmatch("ConnectionManagerService"))) as session by ID
| stats range(_time) as duration by session ID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Apr 2020 13:21:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472719#M133036</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-15T13:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472720#M133037</link>
      <description>&lt;P&gt;Thank you! It works well here, but unfortunately it doesn't on live data. Probably because I provided you with only piece of data related to particular ID. I will try to tweak it.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 15:30:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472720#M133037</guid>
      <dc:creator>slipinski</dc:creator>
      <dc:date>2020-04-15T15:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472721#M133038</link>
      <description>&lt;P&gt;@to4kawa Thank you for your help. I'm in your dept.&lt;BR /&gt;
I'm using the query below to calculate booking time per connection and average time from desired time period.&lt;BR /&gt;
&lt;EM&gt;| stats range(eval(if(searchmatch("ncreations:") OR searchmatch("Config success!"),_time,NULL))) as duration by id&lt;BR /&gt;
| where id!=0 &lt;BR /&gt;
| stats avg(duration)&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;It works perfecty.&lt;BR /&gt;
I also tried to estimate this by using bucket command&lt;BR /&gt;
&lt;EM&gt;bucket _time span=1h | stats avg(duration)&lt;/EM&gt;&lt;BR /&gt;
but it failed, because I had used _time value in command range. I can't use also timechart avg(duration), because of the same reason.&lt;/P&gt;

&lt;P&gt;I guess I have to bind timestamp to "id" . Am I right?&lt;/P&gt;

&lt;P&gt;regards,&lt;BR /&gt;
Szymon&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 18:55:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472721#M133038</guid>
      <dc:creator>slipinski</dc:creator>
      <dc:date>2020-05-05T18:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472722#M133039</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| eval hours=strftime(_time,"%d-%H")
| eventstats range(eval(if(searchmatch("ncreations:") OR searchmatch("Config success!"),_time,NULL))) as duration by id
| where id!=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It might depend on how you calculate the average.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 19:04:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472722#M133039</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-05T19:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Subsearch map command doesn't work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472723#M133040</link>
      <description>&lt;P&gt;Perfect. You're amazing.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 19:17:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subsearch-map-command-doesn-t-work/m-p/472723#M133040</guid>
      <dc:creator>slipinski</dc:creator>
      <dc:date>2020-05-05T19:17:05Z</dc:date>
    </item>
  </channel>
</rss>

