<?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 Exclude specific String from search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/406035#M173648</link>
    <description>&lt;P&gt;I am new to Splunk and would appreciate if anyone helps me on this. I would like to set up a Splunk alert for SocketTimeoutException from all sources. But I would like to exclude from the search if I have the following string "Exception in Client ABC service" in the server logs. This string is on a different line before the line java.net.SocketTimeoutException. For example, I get the following server logs:&lt;/P&gt;

&lt;P&gt;01/15/2019 13:53:11,983 INFO  &lt;A href="https://community.splunk.com/default%20task-501"&gt;stdout&lt;/A&gt;   at java.lang.Thread.run(Thread.java:745)&lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt; [default task-418] ERROR com.foo.ClientABC  - &lt;STRONG&gt;Exception in Client ABC&lt;/STRONG&gt; service :: &lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt; &lt;STRONG&gt;java.net.SocketTimeoutException&lt;/STRONG&gt;: connect timed out&lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt;   at java.net.PlainSocketImpl.socketConnect(Native Method)&lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt;   at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)&lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt;   at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)&lt;BR /&gt;
01/15/2019 13:53:12,684 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt;   at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)&lt;/P&gt;

&lt;P&gt;My Splunk alert right now is:&lt;BR /&gt;
index=XYZ "java.net.SocketTimeoutException" &lt;/P&gt;

&lt;P&gt;I would like to get alerts for all other SocketTimeoutExceptions that don't contain the string &lt;STRONG&gt;Exception in Client ABC&lt;/STRONG&gt; .&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jan 2019 21:03:10 GMT</pubDate>
    <dc:creator>dababi1234</dc:creator>
    <dc:date>2019-01-15T21:03:10Z</dc:date>
    <item>
      <title>Exclude specific String from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/406035#M173648</link>
      <description>&lt;P&gt;I am new to Splunk and would appreciate if anyone helps me on this. I would like to set up a Splunk alert for SocketTimeoutException from all sources. But I would like to exclude from the search if I have the following string "Exception in Client ABC service" in the server logs. This string is on a different line before the line java.net.SocketTimeoutException. For example, I get the following server logs:&lt;/P&gt;

&lt;P&gt;01/15/2019 13:53:11,983 INFO  &lt;A href="https://community.splunk.com/default%20task-501"&gt;stdout&lt;/A&gt;   at java.lang.Thread.run(Thread.java:745)&lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt; [default task-418] ERROR com.foo.ClientABC  - &lt;STRONG&gt;Exception in Client ABC&lt;/STRONG&gt; service :: &lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt; &lt;STRONG&gt;java.net.SocketTimeoutException&lt;/STRONG&gt;: connect timed out&lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt;   at java.net.PlainSocketImpl.socketConnect(Native Method)&lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt;   at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)&lt;BR /&gt;
01/15/2019 13:53:12,683 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt;   at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)&lt;BR /&gt;
01/15/2019 13:53:12,684 INFO  &lt;A href="https://community.splunk.com/default%20task-418"&gt;stdout&lt;/A&gt;   at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)&lt;/P&gt;

&lt;P&gt;My Splunk alert right now is:&lt;BR /&gt;
index=XYZ "java.net.SocketTimeoutException" &lt;/P&gt;

&lt;P&gt;I would like to get alerts for all other SocketTimeoutExceptions that don't contain the string &lt;STRONG&gt;Exception in Client ABC&lt;/STRONG&gt; .&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 21:03:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/406035#M173648</guid>
      <dc:creator>dababi1234</dc:creator>
      <dc:date>2019-01-15T21:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude specific String from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/406036#M173649</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;just add to your search NOT&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=XYZ "java.net.SocketTimeoutException"  NOT "Exception in Client ABC"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if you have a field with the value "Exception in Client ABC" you could add &lt;CODE&gt;field!="Exception in Client ABC"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 10:17:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/406036#M173649</guid>
      <dc:creator>dkeck</dc:creator>
      <dc:date>2019-01-16T10:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude specific String from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/406037#M173650</link>
      <description>&lt;P&gt;It doesn't have any effect if I include NOT "Exception in Client ABC". The problem is that, when I do &lt;STRONG&gt;index=XYZ "java.net.SocketTimeoutException"&lt;/STRONG&gt;, the search results doesn't show the text &lt;STRONG&gt;"Exception in Client ABC"&lt;/STRONG&gt;. But if I expand that, do &lt;STRONG&gt;Event Actions&lt;/STRONG&gt; and do &lt;STRONG&gt;Show Source&lt;/STRONG&gt; I see the line &lt;STRONG&gt;Exception in Client ABC&lt;/STRONG&gt; which is causing the SocketTimeoutException.&lt;/P&gt;

&lt;P&gt;My goal is to display all other causes for &lt;STRONG&gt;SocketTimeoutException&lt;/STRONG&gt;, but I don't want the exception due to &lt;STRONG&gt;Exception in Client ABC&lt;/STRONG&gt; to be shown. Does that make sense?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 16:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/406037#M173650</guid>
      <dc:creator>dababi1234</dc:creator>
      <dc:date>2019-01-16T16:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude specific String from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/569108#M198348</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/159949"&gt;@dababi1234&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Were you able to find solution for this? I am facing similar issue.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 11:00:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/569108#M198348</guid>
      <dc:creator>prateeksawhney</dc:creator>
      <dc:date>2021-09-30T11:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude specific String from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/569111#M198349</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;It seems that in this case all those lines are separate events not a big one which contains the whole error message. If/when you need to do this, then you must first combine those individual lines (which belongs to same error message) to one event and then go through those which are not contains that special message.&lt;/P&gt;&lt;P&gt;I think that better way is correct ingestion phase so that all those lines create only one event and then you can do exclusion as proposed.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 11:26:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/569111#M198349</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-09-30T11:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude specific String from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/569115#M198351</link>
      <description>&lt;P&gt;Exactly. Unfortunately, this is java log/stacktrace which means that its ingestion is an ugly thing. Unfortunately, java logs are usually very ugly to ingest because they're not well-structured and have a very... "free" approach to what is in them.&lt;/P&gt;&lt;P&gt;So sometimes (not in this case though) you can distinguish stacktraces from the rest of the logs because they do not (again - not in this case) have a timestamp at the beginning of the line. But in such case as presented here - there's nothing obvious to build transaction upon. you could try to start it at the beginning of the stacktrace (for example on "\[default-task.*ERROR") but there's no good ending of the transaction. You'd have to dig in your logs a bit deeper to find where the entries end.&lt;/P&gt;&lt;P&gt;Unfortunately, the logs are "distorted" because not only they're are being sent/saved as multiline logs (which splunk can usually handle with some slight help&amp;nbsp; from good configuration, but also separate lines have additional timestamp lines (added by some intermediate "processor"?) which effectively split single event into multiple events.&lt;/P&gt;&lt;P&gt;It's tricky, especially without a context.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 11:41:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Exclude-specific-String-from-search/m-p/569115#M198351</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-30T11:41:49Z</dc:date>
    </item>
  </channel>
</rss>

