<?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: map search question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/map-search-question/m-p/678088#M231891</link>
    <description>&lt;P&gt;map can be slow and limited - try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[| inputlookup testlookup
| table index sourcetype] earliest=-2d@d latest=@d
| eval day=if(_time &amp;lt; relative_time(now(), "-1d@d"), "Yesterday", "Today")
| stats count by day index sourcetype
| eval {day}=count
| stats values(Today) as Today values(Yesterday) as Yesterday by index sourcetype
| fillnull value=0 Yesterday Today
| eval difference=abs(Yesterday - Today)&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 20 Feb 2024 14:45:42 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-02-20T14:45:42Z</dc:date>
    <item>
      <title>map search question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-search-question/m-p/678080#M231889</link>
      <description>&lt;P&gt;I'm using a modified search from splunksearches.com to get the events from the past two days and returning the difference.&amp;nbsp; For all of the indexes and sourcetypes, if it exists, in the testlookup.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;While it works the index and sourcetype does not line up with the results.&amp;nbsp; Mapping I found handles this SPL a little different than a normal search, location of the stats command had to be moved to return the same results.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;My question is there a way to modify the SPL so the index/sourcetype lines up with the results?&amp;nbsp; I'm pretty sure I'll eventually get it but already spent enough time on this.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;thanks&lt;/P&gt;&lt;P&gt;testlookup: &lt;EM&gt;has the columns index and sourcetype&amp;nbsp;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup testlookup
|eval index1=index
|eval sourcetype1=if (isnull(sourcetype),"","sourcetype="+sourcetype)
|appendpipe
[|map search="search index=$index1$ earliest=-48h latest=-24h | bin _time span=1d | eval window=\"Yesterday\"| stats count by _time window  | append [|search index=$index1$ earliest=-24h | eval window=\"Today\"| bin _time span=1d | stats count by _time window  | eval _time=(_time-(60*60*24))] | timechart span=1d sum(count) by window|eval difference = abs(Yesterday - Today)"]| table index1 sourcetype1 Yesterday Today difference&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="24px"&gt;index1&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;sourcetype1&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;yesterday&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;today&amp;nbsp;&lt;/TD&gt;&lt;TD width="12.5%" height="24px"&gt;difference&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;test1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;st_test1&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="12.5%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="12.5%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;10&lt;/TD&gt;&lt;TD width="12.5%" height="25px"&gt;20&lt;/TD&gt;&lt;TD width="12.5%" height="25px"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="12.5%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="12.5%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 14:13:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-search-question/m-p/678080#M231889</guid>
      <dc:creator>ITSplunk117</dc:creator>
      <dc:date>2024-02-20T14:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: map search question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-search-question/m-p/678088#M231891</link>
      <description>&lt;P&gt;map can be slow and limited - try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[| inputlookup testlookup
| table index sourcetype] earliest=-2d@d latest=@d
| eval day=if(_time &amp;lt; relative_time(now(), "-1d@d"), "Yesterday", "Today")
| stats count by day index sourcetype
| eval {day}=count
| stats values(Today) as Today values(Yesterday) as Yesterday by index sourcetype
| fillnull value=0 Yesterday Today
| eval difference=abs(Yesterday - Today)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 20 Feb 2024 14:45:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-search-question/m-p/678088#M231891</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-02-20T14:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: map search question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/map-search-question/m-p/678093#M231893</link>
      <description>&lt;P&gt;Thank you this should work quite well for my needs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 15:00:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/map-search-question/m-p/678093#M231893</guid>
      <dc:creator>ITSplunk117</dc:creator>
      <dc:date>2024-02-20T15:00:12Z</dc:date>
    </item>
  </channel>
</rss>

