<?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 do I check if a field contains text and return the &amp;quot;source&amp;quot; if it doesn't? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343881#M101865</link>
    <description>&lt;P&gt;This will return either Owner, Account, Member, or the entire source.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=source "(?i)(&amp;lt;sourcefound&amp;gt;Owner|Account|Member)"
| eval source=coalesce(sourcefound,source)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 31 Jul 2017 21:32:40 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-07-31T21:32:40Z</dc:date>
    <item>
      <title>How do I check if a field contains text and return the "source" if it doesn't?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343878#M101862</link>
      <description>&lt;P&gt;My current search (below) returns 3 results that has a field called "import_File" that contains either the text "Account", "Owner", or "Member" in the file path. If there is an instance where the search does not contain a file path containing either the text "Account", "Owner", or "Member", I want to return the "source" so I can go in and check it out.&lt;/P&gt;

&lt;P&gt;Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*D:\\filePath\\filePath* source=*filePath\\filePath.log* Moved
| eval todayBuffer=strftime(now(), "%m_%d_%Y") | eval today=ltrim(tostring(todayBuffer),"0") | where like(source,"%".today."%")
| where ((like(source,"%"."ClientID"."%")))
| sort -_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;P&gt;7/31/2017 5:09:18 AM -- Moved D:\filepath\filepath\ClientID\filepath\ClientID\Position\ClientID_Owner_csv.xml Size:26.46 MB &lt;/P&gt;

&lt;P&gt;7/31/2017 5:08:18 AM -- Moved D:\filepath\filepath\ClientID\filepath\ClientID\Account\ClientID_Account_csv.xml Size:586.22 KB &lt;/P&gt;

&lt;P&gt;7/31/2017 5:03:15 AM -- Moved D:\filepath\filepath\ClientID\filepath\ClientID\Member\ClientID_Member_csv.xml Size:3.06 MB&lt;/P&gt;

&lt;P&gt;For example (below), if tomorrow's search does not return an import_File with a file path containing "Member" I would want &lt;BR /&gt;
to return the source.&lt;/P&gt;

&lt;P&gt;Example Problem Search Results:&lt;/P&gt;

&lt;P&gt;8/1/2017 5:09:18 AM -- D:\filepath\filepath\ClientID\filepath\ClientID\Position\ClientID_Owner_csv.xml Size:26.46 MB &lt;/P&gt;

&lt;P&gt;8/1/2017 5:08:18 AM -- D:\filepath\filepath\ClientID\filepath\ClientID\Account\ClientID_Account_csv.xml Size:586.22 KB&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343878#M101862</guid>
      <dc:creator>griffinpair</dc:creator>
      <dc:date>2020-09-29T15:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a field contains text and return the "source" if it doesn't?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343879#M101863</link>
      <description>&lt;P&gt;@griffinpair - Just so you know, there is special markup language on this site so certain symbols will transform your post.  If you wrap a word in the asterisk symbol &lt;CODE&gt;*&lt;/CODE&gt; or &lt;CODE&gt;_&lt;/CODE&gt;, without wrapping it in a &lt;CODE&gt;code sample&lt;/CODE&gt;, it will &lt;EM&gt;italicize&lt;/EM&gt; the word. If you wish to show the &lt;CODE&gt;*&lt;/CODE&gt; (i.e. you are displaying sample code), simply click on the Code Sample icon to the right of the Blockquote icon in the formatting toolbar. That is how I was able to edit your post so that the &lt;CODE&gt;*&lt;/CODE&gt; will display.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 21:16:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343879#M101863</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2017-07-31T21:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a field contains text and return the "source" if it doesn't?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343880#M101864</link>
      <description>&lt;P&gt;What will be the expect output (for the sample data)?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 21:26:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343880#M101864</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-07-31T21:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a field contains text and return the "source" if it doesn't?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343881#M101865</link>
      <description>&lt;P&gt;This will return either Owner, Account, Member, or the entire source.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=source "(?i)(&amp;lt;sourcefound&amp;gt;Owner|Account|Member)"
| eval source=coalesce(sourcefound,source)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2017 21:32:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343881#M101865</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-31T21:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a field contains text and return the "source" if it doesn't?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343882#M101866</link>
      <description>&lt;P&gt;This is a "Alert Dashboard" I am creating. So if all show up (Results) then nothing should show up. If what we expected to show up does not (Example Problem Search Results) then I would want the the "source" to be returned so I can know the log file that has the information on the issue.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 14:47:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343882#M101866</guid>
      <dc:creator>griffinpair</dc:creator>
      <dc:date>2017-08-01T14:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a field contains text and return the "source" if it doesn't?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343883#M101867</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*D:\\filePath\\filePath* source=*filePath\\filePath.log* Moved
 | eval todayBuffer=strftime(now(), "%m_%d_%Y") | eval today=ltrim(tostring(todayBuffer),"0") | where like(source,"%".today."%")
 | where ((like(source,"%"."ClientID"."%"))) | rex field=source "ClientID_(?&amp;lt;type&amp;gt;[^_]+)" | eventstats values(type) as type
 | sort -_time | where mvcount(type)&amp;lt;3  | table source ..other fields you want...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Aug 2017 15:31:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-check-if-a-field-contains-text-and-return-the-quot/m-p/343883#M101867</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-08-01T15:31:01Z</dc:date>
    </item>
  </channel>
</rss>

