<?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: How to use map command to run for each deviceid in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650319#M224811</link>
    <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="xxxx" source="*$Device_ID$*xxxx*"
| eval Device_ID=mvindex(split(source,"/"),5)
| rex field=_raw "(?&amp;lt;timestamp&amp;gt;[^|]+)"
| table Device_ID timestamp
| streamstats count as s_no by Device_ID
| sort 0 - s_no
| table Device_ID s_no timestamp
| eval time=strptime(timestamp,"%F %T.%4N")
| streamstats global=f max(time) as latest_time by Device_ID
| where time &amp;gt;= latest_time&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 13 Jul 2023 05:36:23 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-07-13T05:36:23Z</dc:date>
    <item>
      <title>How to use map command to run for each deviceid?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650117#M224761</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have the following query,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="xxxx" source="*$Device_ID$*xxxx*"
| eval Device_ID=mvindex(split(source,"/"),5)
| rex field=_raw "(?&amp;lt;timestamp&amp;gt;[^|]+)"
| table Device_ID timestamp
| streamstats count as s_no by Device_ID
| sort 0 - s_no
| table Device_ID s_no timestamp

&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;How to use map or foreach command for the above query so it will run separately for each Deviceid&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 16:10:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650117#M224761</guid>
      <dc:creator>Kirthika</dc:creator>
      <dc:date>2023-07-12T16:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use map command to run for each deviceid</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650178#M224782</link>
      <description>&lt;P&gt;The provided query appears to run for each Device_ID already.&amp;nbsp; How is the query not meeting your expectations?&amp;nbsp; What is the use case?&amp;nbsp; Why do you think you need &lt;FONT face="courier new,courier"&gt;map&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;foreach&lt;/FONT&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 12:55:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650178#M224782</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-07-12T12:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use map command to run for each deviceid</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650234#M224793</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my whole query.&lt;/P&gt;&lt;P&gt;index="xxxx" source="*$Device_ID$*xxxx*"&lt;BR /&gt;| eval Device_ID=mvindex(split(source,"/"),5)&lt;BR /&gt;| rex field=_raw "(?&amp;lt;timestamp&amp;gt;[^|]+)"&lt;BR /&gt;| table Device_ID timestamp&lt;BR /&gt;| streamstats count as s_no by Device_ID&lt;BR /&gt;| sort 0 - s_no&lt;BR /&gt;| table Device_ID s_no timestamp&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to remove events which is decreasing inbetween. Here I have used "filldown" command. So it is messing up with other devices.&lt;/P&gt;&lt;P&gt;To get of this, I want to use map or foreach. But not sure how to implement in the above query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Data:&lt;/P&gt;&lt;P&gt;Timestamp&amp;nbsp;&lt;/P&gt;&lt;P&gt;2021-08-09 12:26:55.7852&lt;BR /&gt;2021-08-09 12:26:56.2278&lt;BR /&gt;2021-08-09 12:26:56.2278&lt;BR /&gt;2021-08-09 12:26:56.3939&lt;BR /&gt;&lt;STRONG&gt;2021-08-09 12:26:39.2861&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;2021-08-09 12:26:40.3430&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;2021-08-09 12:26:41.3482&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;2021-08-09 12:26:41.4832&lt;/STRONG&gt;&lt;BR /&gt;2021-08-09 12:26:56.8794&lt;BR /&gt;2021-08-09 12:26:57.8846&lt;BR /&gt;2021-08-09 12:26:58.9398&lt;BR /&gt;2021-08-09 12:26:59.9450&lt;BR /&gt;2021-08-09 12:26:59.9700&lt;BR /&gt;2021-08-09 12:26:59.9700&lt;BR /&gt;2021-08-09 12:27:00.8201&lt;BR /&gt;2021-08-09 12:27:00.8401&lt;BR /&gt;2021-08-09 12:27:01.0352&lt;BR /&gt;2022-03-30 10:09:25.6406&lt;BR /&gt;2022-03-30 10:09:25.8007&lt;BR /&gt;2022-03-30 10:09:26.8109&lt;BR /&gt;2022-03-30 10:09:27.5961&lt;BR /&gt;2022-03-30 10:09:27.5961&lt;/P&gt;&lt;P&gt;If you see the timestamp which is marked as bold, seconds value got decreasing inbetween , I'm trying to ignore those events.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Somecase hours or minutes also will decrease&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 17:26:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650234#M224793</guid>
      <dc:creator>Kirthika</dc:creator>
      <dc:date>2023-07-13T17:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use map command to run for each deviceid</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650241#M224794</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval time=strptime(timestamp,"%F %T.%4N")
| streamstats max(time) as latest_time
| where time &amp;gt;= latest_time&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Jul 2023 15:50:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650241#M224794</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-07-12T15:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use map command to run for each deviceid</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650260#M224798</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;. Can you please help me with where should i add those lines you mentioned&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 17:47:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650260#M224798</guid>
      <dc:creator>Kirthika</dc:creator>
      <dc:date>2023-07-12T17:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use map command to run for each deviceid</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650319#M224811</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="xxxx" source="*$Device_ID$*xxxx*"
| eval Device_ID=mvindex(split(source,"/"),5)
| rex field=_raw "(?&amp;lt;timestamp&amp;gt;[^|]+)"
| table Device_ID timestamp
| streamstats count as s_no by Device_ID
| sort 0 - s_no
| table Device_ID s_no timestamp
| eval time=strptime(timestamp,"%F %T.%4N")
| streamstats global=f max(time) as latest_time by Device_ID
| where time &amp;gt;= latest_time&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Jul 2023 05:36:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/650319#M224811</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-07-13T05:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use map command to run for each deviceid</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/652004#M225371</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;| streamstats global=f max(time) as latest_time by Device_ID
| where time &amp;gt;= latest_time&lt;/PRE&gt;&lt;P&gt;This is giving accurate results. But when i enable scheduled search, it is running in fast mode. In fast mode, I found few events are missing. Is there any alternate way for this command&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 06:27:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-map-command-to-run-for-each-deviceid/m-p/652004#M225371</guid>
      <dc:creator>Kirthika</dc:creator>
      <dc:date>2023-07-26T06:27:37Z</dc:date>
    </item>
  </channel>
</rss>

