<?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 to Parse Results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-Parse-Results/m-p/36777#M8179</link>
    <description>&lt;P&gt;Probably the most straight-forward way to do this is to use a regular expression. It's quite easy to translate such a substring expression to regex. In order to see the altered message, you have to change the content of the &lt;STRONG&gt;_raw&lt;/STRONG&gt; field.&lt;/P&gt;

&lt;P&gt;eg.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;substring(message, charindex(message, "foo"), 20)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;would be translated as&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysourcetype | rex "(?&amp;lt;_raw&amp;gt;foo.{17})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can as well use the eval command to extract substrings, but there's no charindex equivalent available:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysourcetype | eval _raw=substr(_raw, 5, 25)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 02 Feb 2011 00:59:18 GMT</pubDate>
    <dc:creator>ziegfried</dc:creator>
    <dc:date>2011-02-02T00:59:18Z</dc:date>
    <item>
      <title>How to Parse Results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Parse-Results/m-p/36776#M8178</link>
      <description>&lt;P&gt;I am interested in seeing only pieces of a message in the results.  I would like to be able to run a search and return only a substring of the message.  In sql, it would be something like "substring(message, charindex(message, 'somestringvalue'), somelength)" and thus my results would only contain the information I was interested in.&lt;/P&gt;

&lt;P&gt;Is there a way to do this?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2011 00:29:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Parse-Results/m-p/36776#M8178</guid>
      <dc:creator>jfolland</dc:creator>
      <dc:date>2011-02-02T00:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Parse Results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Parse-Results/m-p/36777#M8179</link>
      <description>&lt;P&gt;Probably the most straight-forward way to do this is to use a regular expression. It's quite easy to translate such a substring expression to regex. In order to see the altered message, you have to change the content of the &lt;STRONG&gt;_raw&lt;/STRONG&gt; field.&lt;/P&gt;

&lt;P&gt;eg.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;substring(message, charindex(message, "foo"), 20)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;would be translated as&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysourcetype | rex "(?&amp;lt;_raw&amp;gt;foo.{17})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can as well use the eval command to extract substrings, but there's no charindex equivalent available:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mysourcetype | eval _raw=substr(_raw, 5, 25)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Feb 2011 00:59:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Parse-Results/m-p/36777#M8179</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-02-02T00:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to Parse Results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Parse-Results/m-p/36778#M8180</link>
      <description>&lt;P&gt;The answer can also depend on what you mean by substring.  For presentation purposes, there are generally better mechanisms to carve up the raw data.  If the relevant data is in fields then you can "table" them as well.  Depending on the purpose, this can be prettier to look at:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;fail* sourcetype=syslog | table pid, process
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Feb 2011 07:48:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Parse-Results/m-p/36778#M8180</guid>
      <dc:creator>mw</dc:creator>
      <dc:date>2011-02-02T07:48:49Z</dc:date>
    </item>
  </channel>
</rss>

