<?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 replacing and output in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/replacing-and-output/m-p/335887#M99737</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I have the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index =datapower environment=PROD mpgw(Subscription-Aysnc) 'HTTP response code*'
| rex field=_raw  "HTTP response code?(?&amp;lt;responseCode&amp;gt;.{4})"
| stats count by  responseCode 
| rex field=responseCode mode=sed "s/200/Success/g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, the &lt;CODE&gt;| rex field=responseCode mode=sed "s/200/Success/g"&lt;/CODE&gt; is not working.  I have also tried &lt;CODE&gt;| replace "200" with "Success"&lt;/CODE&gt; and nothing...  What am I doing wrong?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 14 Apr 2017 20:42:41 GMT</pubDate>
    <dc:creator>leomedina</dc:creator>
    <dc:date>2017-04-14T20:42:41Z</dc:date>
    <item>
      <title>replacing and output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/replacing-and-output/m-p/335887#M99737</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I have the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index =datapower environment=PROD mpgw(Subscription-Aysnc) 'HTTP response code*'
| rex field=_raw  "HTTP response code?(?&amp;lt;responseCode&amp;gt;.{4})"
| stats count by  responseCode 
| rex field=responseCode mode=sed "s/200/Success/g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, the &lt;CODE&gt;| rex field=responseCode mode=sed "s/200/Success/g"&lt;/CODE&gt; is not working.  I have also tried &lt;CODE&gt;| replace "200" with "Success"&lt;/CODE&gt; and nothing...  What am I doing wrong?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 20:42:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/replacing-and-output/m-p/335887#M99737</guid>
      <dc:creator>leomedina</dc:creator>
      <dc:date>2017-04-14T20:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: replacing and output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/replacing-and-output/m-p/335888#M99738</link>
      <description>&lt;P&gt;Instead of doing the rex, use a lookup which would be more in line with what you probably want anyway if you want more than 200's replaced. You will have to install a CSV file of the codes with their long name responseCode, then use your search doing something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index =datapower environment=PROD mpgw(Subscription-Aysnc) 'HTTP response code*'
| rex field=_raw  "HTTP response code?(?&amp;lt;code&amp;gt;.{4})"
| lookup httpcodes code OUTPUT responseCode
| stats count by responseCode
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The format of you CSV should be something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;code,responseCode,info
100,Continue,Informational
101,Switching Protocols,Informational
200,OK,Successful
201,Created,Successful
202,Accepted,Successful
203,Non-Authoritative Information,Successful
204,No Content,Successful
205,Reset Content,Successful
206,Partial Content,Successful
300,Multiple Choices,Redirection
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Apr 2017 20:53:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/replacing-and-output/m-p/335888#M99738</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-04-14T20:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: replacing and output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/replacing-and-output/m-p/335889#M99739</link>
      <description>&lt;P&gt;The problem is that you are capturing &lt;CODE&gt;4 any characters&lt;/CODE&gt; with &lt;CODE&gt;.{4}&lt;/CODE&gt; and then you are comparing to &lt;CODE&gt;200&lt;/CODE&gt; which is only 3 characters long.  These must match or be otherwise compatible.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index =datapower environment=PROD mpgw(Subscription-Aysnc) 'HTTP response code*'
| rex field=_raw  "HTTP response code\D*(?&amp;lt;responseCode&amp;gt;\d+)"
| stats count BY responseCode 
| rex field=responseCode mode=sed "s/200/Success/g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Apr 2017 23:56:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/replacing-and-output/m-p/335889#M99739</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-04-15T23:56:31Z</dc:date>
    </item>
  </channel>
</rss>

