<?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: Adding search to a search in search string .... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409789#M173608</link>
    <description>&lt;P&gt;@bogdan_nicolescu , It's possible to add the search . Just to understand it better, what's the problem when you add the following to the end of the search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | search employee="Bogdan Nicolescu" date_access="2019-01-15"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 18 Jan 2019 05:24:47 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2019-01-18T05:24:47Z</dc:date>
    <item>
      <title>Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409788#M173607</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;What i try to ask is if that i can add to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index="bogdan")
| rename Date AS RootObject.Date
         access_permited AS RootObject.access_permited
         created_date AS RootObject.created_date
         date_access AS RootObject.date_access
         first_name AS RootObject.first_name
         hr_access AS RootObject.hr_access
         last_name AS RootObject.last_name
         min_access AS RootObject.min_access
         msecs AS RootObject.msecs
         qr_code AS RootObject.qr_code
         reader_id AS RootObject.reader_id
         sec_access AS RootObject.sec_access
| fields _time host source sourcetype "RootObject.Date" "RootObject.access_permited" "RootObject.created_date" "RootObject.date_access" "RootObject.first_name" "RootObject.hr_access" "RootObject.last_name" "RootObject.min_access" "RootObject.msecs" "RootObject.qr_code" "RootObject.reader_id" "RootObject.sec_access"
| stats dedup_splitvals=t count AS "Count of 1547566823.1090"
 BY RootObject.date_access, RootObject.hr_access, RootObject.min_access, RootObject.sec_access, RootObject.msecs, RootObject.first_name, RootObject.last_name
| sort limit=100000 RootObject.date_access
| fields - _span
| rename RootObject.date_access AS date_access
         RootObject.hr_access AS hr_access
         RootObject.min_access AS min_access
         RootObject.sec_access AS sec_access
         RootObject.msecs AS msecs
         RootObject.first_name AS first_name
         RootObject.last_name AS last_name
| fillnull "Count of 1547566823.1090"
| fields date_access, hr_access, min_access, sec_access, msecs, first_name, last_name, "Count of 1547566823.1090"
| strcat first_name " " last_name employee
| search employee="Bogdan Nicolescu"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;An additional search like: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search date_access="2019-01-15"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've already tried, but, after a while is showing me a result, but after another while it stops showing something altogether.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 15:45:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409788#M173607</guid>
      <dc:creator>bogdan_nicolesc</dc:creator>
      <dc:date>2019-01-16T15:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409789#M173608</link>
      <description>&lt;P&gt;@bogdan_nicolescu , It's possible to add the search . Just to understand it better, what's the problem when you add the following to the end of the search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | search employee="Bogdan Nicolescu" date_access="2019-01-15"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jan 2019 05:24:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409789#M173608</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-18T05:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409790#M173609</link>
      <description>&lt;P&gt;Hi Renjith,&lt;/P&gt;

&lt;P&gt;If i add that string to my search, i get no result.&lt;/P&gt;

&lt;P&gt;BUT! if i do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index="bogdan" Bogdan Nicolescu)  | rename Date AS RootObject.Date access_permited AS RootObject.access_permited created_date AS RootObject.created_date date_access AS RootObject.date_access first_name AS RootObject.first_name hr_access AS RootObject.hr_access last_name AS RootObject.last_name min_access AS RootObject.min_access msecs AS RootObject.msecs qr_code AS RootObject.qr_code reader_id AS RootObject.reader_id sec_access AS RootObject.sec_access | fields "_time" "host" "source" "sourcetype" "RootObject.Date" "RootObject.access_permited" "RootObject.created_date" "RootObject.date_access" "RootObject.first_name" "RootObject.hr_access" "RootObject.last_name" "RootObject.min_access" "RootObject.msecs" "RootObject.qr_code" "RootObject.reader_id" "RootObject.sec_access" | stats dedup_splitvals=t count AS "Count of 1547566823.1090"  by RootObject.date_access, RootObject.hr_access, RootObject.min_access, RootObject.sec_access, RootObject.msecs, RootObject.first_name, RootObject.last_name | sort limit=100000 RootObject.date_access | fields - _span  | rename RootObject.date_access AS date_access RootObject.hr_access AS hr_access RootObject.min_access AS min_access RootObject.sec_access AS sec_access RootObject.msecs AS msecs RootObject.first_name AS first_name RootObject.last_name AS last_name  | fillnull "Count of 1547566823.1090" | fields date_access, hr_access, min_access, sec_access, msecs, first_name, last_name, "Count of 1547566823.1090" | strcat first_name " " last_name employee | search date_access="2018-06-21"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get what i was looking for.&lt;/P&gt;

&lt;P&gt;Thank you for your time.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 17:14:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409790#M173609</guid>
      <dc:creator>bogdan_nicolesc</dc:creator>
      <dc:date>2019-01-18T17:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409791#M173610</link>
      <description>&lt;P&gt;@bogdan_nicolescu , is it possible that you dont have data for 2019-01-15 ? Do you see the data in the events when no filter is applied?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jan 2019 07:53:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409791#M173610</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-19T07:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409792#M173611</link>
      <description>&lt;P&gt;My last message was to pint out if i use  | search employee="Bogdan Nicolescu" date_access="2019-01-15" i don't get any result.&lt;/P&gt;

&lt;P&gt;BUT! (bubble but) if i use: (index="bogdan" Bogdan Nicolescu)  |   (..........)   | search date_access="2018-06-21" i get what i want.&lt;/P&gt;

&lt;P&gt;SO! (like saw, not the movie saw, but just plain saw) in order to apply 2 searches, you need to put the very first variable NEXT to the | index="" | and then the last variable in the very last place.&lt;/P&gt;

&lt;P&gt;Hope this makes (shades) crystal (or dimond) clear.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 07:58:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409792#M173611</guid>
      <dc:creator>bogdan_nicolesc</dc:creator>
      <dc:date>2019-01-21T07:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409793#M173612</link>
      <description>&lt;P&gt;date_access is string or date field?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 10:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409793#M173612</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2019-01-21T10:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409794#M173613</link>
      <description>&lt;P&gt;Its crystal clear but both of your searches are not same. In the search where you get the results, you are not using the field name &lt;CODE&gt;employee&lt;/CODE&gt; (or at least as mentioned in the text above) which makes a difference in how splunk gets the events for you. That's why it was asked whether you are able to see the data before the filter is applied (search=). For e.g. are you seeing the employee data if you do&lt;BR /&gt;
&lt;CODE&gt;"your search" | strcat first_name " " last_name employee | table employee ,date_access&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 10:45:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409794#M173613</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-01-21T10:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409795#M173614</link>
      <description>&lt;P&gt;Short answer, yes.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 12:13:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409795#M173614</guid>
      <dc:creator>bogdan_nicolesc</dc:creator>
      <dc:date>2019-01-21T12:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409796#M173615</link>
      <description>&lt;P&gt;Date field.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 12:13:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409796#M173615</guid>
      <dc:creator>bogdan_nicolesc</dc:creator>
      <dc:date>2019-01-21T12:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409797#M173616</link>
      <description>&lt;P&gt;In general you could add as many search terms as you like - directly after the &lt;CODE&gt;index=...&lt;/CODE&gt; or somewhere else in your search string (of course, where it makes sense).&lt;/P&gt;

&lt;P&gt;First you should cleanup your SPL. You do a lot of renaming in the 2nd part just to rename all of the fields back to their original name later on.&lt;/P&gt;

&lt;P&gt;Further down you have three &lt;CODE&gt;fields&lt;/CODE&gt; commands - the first one containing your renamed fields and the last containing all your back-renamed fields.&lt;/P&gt;

&lt;P&gt;It makes reading your SPL much easier if it only contains the necessary parts - even for you &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;And at last: please stay consistent in your searches. If you get a result only using &lt;CODE&gt;date_access=2018-06-21&lt;/CODE&gt; you should use this exact date when adding some more search string like &lt;CODE&gt;employee="Bodgan Nicolescu" date_access=2018-06-21&lt;/CODE&gt;. Otherwise your results are not comparable at all.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 13:52:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409797#M173616</guid>
      <dc:creator>rvany</dc:creator>
      <dc:date>2019-01-21T13:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409798#M173617</link>
      <description>&lt;P&gt;I have no idea what you are trying to do but your existing search can be simplified to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="bogdan"
| stats count AS "Count of 1547566823.1090" BY date_access hr_access min_access sec_access msecs first_name last_name
| sort 0 date_access
| strcat first_name " " last_name employee
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can then add stuff like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search employee="Bogdan Nicolescu"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search employee="Bogdan Nicolescu" AND date_access="2019-01-15"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that in general, the &lt;CODE&gt;| search ...&lt;/CODE&gt; stuff should be done at the top, but I assume that you have a base search that is being used to power several other searches, which is smart.  If that's not what you are doing, you should move it to the top like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="bogdan" AND first_name="Bogdan" AND last_name="Nicolescu"
| stats count AS "Count of 1547566823.1090" BY date_access hr_access min_access sec_access msecs first_name last_name
| sort 0 date_access
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Jan 2019 21:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409798#M173617</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-21T21:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Adding search to a search in search string ....</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409799#M173618</link>
      <description>&lt;P&gt;Hi WoodCock,&lt;/P&gt;

&lt;P&gt;Thank you very Much, worked like a charm.&lt;/P&gt;

&lt;P&gt;Bogdan.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 12:06:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-search-to-a-search-in-search-string/m-p/409799#M173618</guid>
      <dc:creator>bogdan_nicolesc</dc:creator>
      <dc:date>2019-01-25T12:06:59Z</dc:date>
    </item>
  </channel>
</rss>

