<?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: Search not returning results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593007#M206409</link>
    <description>&lt;P&gt;I added "Store 123456" to main search and removed it from regex, but still get "no results found."&lt;/P&gt;</description>
    <pubDate>Thu, 07 Apr 2022 20:49:26 GMT</pubDate>
    <dc:creator>jymmitch</dc:creator>
    <dc:date>2022-04-07T20:49:26Z</dc:date>
    <item>
      <title>Why is my Search not returning results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/592985#M206396</link>
      <description>&lt;P&gt;Here's the text string from the log I'm searching:&lt;/P&gt;
&lt;P&gt;store license for Store 123456&lt;BR /&gt;2022-04-07 19:17:44,360 ERROR path not found&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my splunk search:&lt;/P&gt;
&lt;P&gt;index=* host="storelog*" "store license for " |rex field=_raw "Store\s123456\n\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\,\d{3}\s(?P&amp;lt;errortext&amp;gt;.*)path" | stats count by errortext&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why am I getting the following when I search?&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;No results found.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 14:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/592985#M206396</guid>
      <dc:creator>jymmitch</dc:creator>
      <dc:date>2022-04-08T14:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/592990#M206401</link>
      <description>&lt;P&gt;Is the&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;errortext&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp; field created by the rex command being populated correctly? One possible explanation could be that the regex is not matching the text in the events.&lt;/P&gt;&lt;P&gt;You can execute the search again without the stats command and see if the&amp;nbsp; &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;errortext&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp; field is present for the desired events.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 20:06:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/592990#M206401</guid>
      <dc:creator>newrose</dc:creator>
      <dc:date>2022-04-07T20:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/592991#M206402</link>
      <description>&lt;P&gt;I took off the stats command and reran the search, but the &lt;FONT face="times new roman,times"&gt;errortext&lt;/FONT&gt; field is NOT in the events.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 20:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/592991#M206402</guid>
      <dc:creator>jymmitch</dc:creator>
      <dc:date>2022-04-07T20:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/592992#M206403</link>
      <description>&lt;P&gt;could you please share more sample events as I do not see any error in your search.&lt;/P&gt;&lt;P&gt;I have tried in this run anywhere search&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;| makeresults 
| eval _raw="store license for Store 123456
2022-04-07 19:17:44,360 ERROR path not found" 
| rex field=_raw "Store\s123456\n\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\,\d{3}\s(?P&amp;lt;errortext&amp;gt;.*)path" 
| stats count by errortext&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the regex I could see that you are searching&amp;nbsp; for "Store 123456", please add that in the main search instead of in regex.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=* host="storelog*" "store license for Store 123456"&lt;/LI-CODE&gt;&lt;P&gt;Also is it a multiline event? that means is timestamp is on new line in raw logs or its just one line?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 20:23:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/592992#M206403</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2022-04-07T20:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593006#M206408</link>
      <description>&lt;P&gt;Timestamp is on a new line&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 20:46:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593006#M206408</guid>
      <dc:creator>jymmitch</dc:creator>
      <dc:date>2022-04-07T20:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593007#M206409</link>
      <description>&lt;P&gt;I added "Store 123456" to main search and removed it from regex, but still get "no results found."&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 20:49:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593007#M206409</guid>
      <dc:creator>jymmitch</dc:creator>
      <dc:date>2022-04-07T20:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593009#M206410</link>
      <description>&lt;P&gt;The regex will not work considering the sample events you provided.&lt;/P&gt;&lt;P&gt;If the event starts with the timestamp and is single lined maybe you should try this regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=_raw "\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\,\d{3}\s(?P&amp;lt;errortext&amp;gt;.*)path"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 20:59:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593009#M206410</guid>
      <dc:creator>newrose</dc:creator>
      <dc:date>2022-04-07T20:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593010#M206411</link>
      <description>&lt;P&gt;There is a timestamp preceding the text in my main search, but there is also a timestamp that follows it. I'm only searching from the main search text forward:&lt;/P&gt;&lt;P&gt;raw log text:&lt;BR /&gt;&lt;SPAN&gt;store license for Store 123456&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2022-04-07 19:17:44,360 ERROR path not found&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index=* host="storelog*" "store license for " |rex field=_raw "Store\s123456\n\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\,\d{3}\s(?P&amp;lt;errortext&amp;gt;.*)path" | stats count by errortext&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Based on my search, I would think splunk should recognize the&amp;nbsp;"store license for " text, then recognize the single whitespace, then recognize the&amp;nbsp;"Store\s123456" text in the regex, then recognize the newline (\n), then recognize the date/timestamp, and finally set errortext field to ERROR.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 21:12:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593010#M206411</guid>
      <dc:creator>jymmitch</dc:creator>
      <dc:date>2022-04-07T21:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593013#M206413</link>
      <description>&lt;P&gt;I won't give you a solution because I tend to avoid such events &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; but the main problem is most probably the fact that your event is multiline and by default regex matches only over single line.&lt;/P&gt;&lt;P&gt;Try for yourself:&lt;/P&gt;&lt;PRE&gt;| makeresults &lt;BR /&gt;| eval a="abcd&lt;BR /&gt;fghi"&lt;BR /&gt;| rex field=a "(?&amp;lt;b&amp;gt;.*)"&lt;/PRE&gt;&lt;P&gt;You will only get the first line as a results.&lt;/P&gt;&lt;P&gt;You have to fiddle with the single/multiline regex modifiers to make your rex work across the newline. Might work with the (?s) modifier at the beginning of your expression.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 21:42:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593013#M206413</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-07T21:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593016#M206414</link>
      <description>&lt;P&gt;I have other searches that work where the regex matches over two lines. The only difference between those and this one is the fact that this one includes a datestamp&amp;nbsp; (the others don't).&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 21:53:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593016#M206414</guid>
      <dc:creator>jymmitch</dc:creator>
      <dc:date>2022-04-07T21:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593020#M206417</link>
      <description>&lt;P&gt;If I correctly understood your logic, it isn't exactly how Splunk is interpreting your query, although the selected events will probably be the same.&lt;/P&gt;&lt;P&gt;Your base search,&lt;/P&gt;&lt;PRE&gt;index=* host="storelog*" "store license for "&lt;/PRE&gt;&lt;P&gt;will extract all events which have the "store license for " string, including the single whitespace.&lt;/P&gt;&lt;P&gt;Then it will run the &lt;FONT face="helvetica"&gt;rex over all the selected commands, and the regex will try the match starting from the beginning of the event, not from where you stopped from the previous command.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;To overcome the newline issue, check if it is possible given your dataset to run something like this:&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;index=* host="storelog*" "store license for Store 123456" &lt;BR /&gt;| rex field=_raw "\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\,\d{3}\s(?P&amp;lt;errortext&amp;gt;.*)path" &lt;BR /&gt;| stats count by errortext&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The "Store 123456" was moved to the main search, and the regex will try to match starting from the timestamp.&lt;/P&gt;&lt;P&gt;Also you should probably look over this data input parameters, as the raw events doesn't look to have the right boundaries from what you showed here.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 22:32:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593020#M206417</guid>
      <dc:creator>newrose</dc:creator>
      <dc:date>2022-04-07T22:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593049#M206431</link>
      <description>&lt;P&gt;It sounds kinda strange since the single/multiline behaviour is repeatable. And while matching regex to a string Splunk doesn't care whether the event contains timestamp, social securiyy number, your shoe size or whatever other data you can have. It's just text - if it fits, it fits.&lt;/P&gt;&lt;P&gt;OK. It's interesting because sometimes indeed (as in my example) Splunk treats regexes as single line, sometimes as multiline.&lt;/P&gt;&lt;P&gt;Anyway, your initial data sample together with your regex works for me.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PickleRick_0-1649406153881.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19004iC5C5C3F99FD43177/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PickleRick_0-1649406153881.png" alt="PickleRick_0-1649406153881.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;BTW, your "no results found" might mean that no events matched your search, not that the rex command extracted the field wrongly or not at all.&lt;/P&gt;&lt;P&gt;See the "Inspect Job" and see if you got anything from the initial search.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 08:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593049#M206431</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-08T08:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Search not returning results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593115#M206445</link>
      <description>&lt;P&gt;That worked!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 13:49:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-Search-not-returning-results/m-p/593115#M206445</guid>
      <dc:creator>jymmitch</dc:creator>
      <dc:date>2022-04-08T13:49:53Z</dc:date>
    </item>
  </channel>
</rss>

