<?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: timechart not respecting exclude searches but stats is in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472459#M132945</link>
    <description>&lt;P&gt;Perfect, thank you. This has done exactly what I wanted. &lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2019 22:19:34 GMT</pubDate>
    <dc:creator>mmqt</dc:creator>
    <dc:date>2019-09-10T22:19:34Z</dc:date>
    <item>
      <title>timechart not respecting exclude searches but stats is</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472455#M132941</link>
      <description>&lt;P&gt;I have some Json data that looks like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{  
   "target":[  
      {  
         "detailEntry":{  
            "signOnModeType":"dummy info"
         },
         "alternateId":"AppName1",
         "displayName":"dummy info",
         "id":"dummy info",
         "type":"AppInstance"
      },
      {  
         "detailEntry":null,
         "alternateId":"someemail@domain.com",
         "displayName":"dummy info for email",
         "id":"dummy info",
         "type":"AppUser"
      }
   ]}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I then have a search to grab the alternateId but I only want the 'AppName1' info and not the '&lt;A href="mailto:someemail@domain.com"&gt;someemail@domain.com&lt;/A&gt;' since they both use "alternateId" if you just search target{}.alternateId both values are returned, but if you do spath and then use a regex and state to not match emails I get the results I want. Doing stats on like target{0}.alternateId (or any number) also returns zero results. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=events (target{}.alternateId="*") | spath | rename target{}.alternateId as appId | stats count by appId | regex appId!="([a-z0-9][-a-z0-9_\+\.]*[a-zA-Z0-9])@([a-zA-Z0-9][-a-zA-Z0-9\.]*[a-zA-Z0-9]\.(ca|com|org|net)|([0-9]{1,3}\.{3}[0-9]{1,3}))" | sort -count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This above command runs as expected and only returns results for the AppName1. But if I use the same type of search and use a timechart rather than a stats or chart command it doesnt respect the &lt;EM&gt;regex appId!=&lt;/EM&gt; and still displays all matches of target{}.alternateId including email addresses&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ndex=events (target{}.alternateId="*") | spath | rename target{}.alternateId as appId | timechart count by appId usenull=f limit=5 useother=f | regex appId!="([a-z0-9][-a-z0-9_\+\.]*[a-zA-Z0-9])@([a-zA-Z0-9][-a-zA-Z0-9\.]*[a-zA-Z0-9]\.(ca|com|org|net)|([0-9]{1,3}\.{3}[0-9]{1,3}))"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Putting the regex appId!= before the timechart actually returns zero results &lt;/P&gt;

&lt;P&gt;Am I doing something wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 22:29:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472455#M132941</guid>
      <dc:creator>mmqt</dc:creator>
      <dc:date>2019-09-04T22:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not respecting exclude searches but stats is</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472456#M132942</link>
      <description>&lt;P&gt;By using &lt;CODE&gt;timechart&lt;/CODE&gt; command, you no longer has a field name &lt;STRONG&gt;appId&lt;/STRONG&gt;. Obviously, your RegEx filter will fail.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 02:52:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472456#M132942</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2019-09-05T02:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not respecting exclude searches but stats is</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472457#M132943</link>
      <description>&lt;P&gt;Putting the regex before the timechart command returns zero results as well though which should be calculated before the timehchart. What would the appId field change to after being piped into timechart &lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 06:06:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472457#M132943</guid>
      <dc:creator>mmqt</dc:creator>
      <dc:date>2019-09-05T06:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not respecting exclude searches but stats is</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472458#M132944</link>
      <description>&lt;P&gt;You can use &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/SearchReference/Mvexpand"&gt;mvexpand&lt;/A&gt; command for your use-case as shown below..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval message="  {  
    \"target\":[  
       {  
          \"detailEntry\":{  
             \"signOnModeType\":\"dummy info\"
              },
          \"alternateId\":\"AppName1\",
          \"displayName\":\"dummy info\",
          \"id\":\"dummy info\",
          \"type\":\"AppInstance\"
           },
       {  
          \"detailEntry\":null,
          \"alternateId\":\"someemail@domain.com\",
          \"displayName\":\"dummy info for email\",
          \"id\":\"dummy info\",
          \"type\":\"AppUser\"
           }
    ]}" 
| spath input=message 
| eval _time=now()
| rename target{}.alternateId as appId
| mvexpand appId
| fields appId, _time
| regex appId!="([a-z0-9][-a-z0-9_\+\.]*[a-zA-Z0-9])@([a-zA-Z0-9][-a-zA-Z0-9\.]*[a-zA-Z0-9]\.(ca|com|org|net)|([0-9]{1,3}\.{3}[0-9]{1,3}))"
| timechart count by appId usenull=f limit=5 useother=f
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As per your query, the RegEx was not working with &lt;CODE&gt;timechart&lt;/CODE&gt; command as there are multi-values in the &lt;CODE&gt;appId&lt;/CODE&gt; field. The &lt;CODE&gt;mvexpand&lt;/CODE&gt; command expands the values of a multivalue field into separate events and the your can use the &lt;CODE&gt;regex&lt;/CODE&gt; to filter events.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 00:47:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472458#M132944</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2019-09-06T00:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not respecting exclude searches but stats is</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472459#M132945</link>
      <description>&lt;P&gt;Perfect, thank you. This has done exactly what I wanted. &lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 22:19:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472459#M132945</guid>
      <dc:creator>mmqt</dc:creator>
      <dc:date>2019-09-10T22:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: timechart not respecting exclude searches but stats is</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472460#M132946</link>
      <description>&lt;P&gt;Glad it helped you.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 22:23:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-not-respecting-exclude-searches-but-stats-is/m-p/472460#M132946</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2019-09-10T22:23:01Z</dc:date>
    </item>
  </channel>
</rss>

