<?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: SEDCMD search inline question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279354#M84370</link>
    <description>&lt;P&gt;Removing the parens returns the same results as well&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2016 18:07:55 GMT</pubDate>
    <dc:creator>tkwaller</dc:creator>
    <dc:date>2016-04-08T18:07:55Z</dc:date>
    <item>
      <title>SEDCMD search inline question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279349#M84365</link>
      <description>&lt;P&gt;I am trying to test a sedcmd command, inline, that Im going to add. I am finding a string and replacing it with a field="string with spaces"&lt;BR /&gt;
Heres a log sample:&lt;BR /&gt;
2016-04-08 15:04:14,711 [_498147344979146612131995] priority=ERROR thread=http-nio-10010-exec-9 location=com.xxx.search.suggest.v3.impl Found invalid sort sields, invalidFields=eventDateLocal asc&lt;/P&gt;

&lt;P&gt;I want to replace:&lt;BR /&gt;
Found invalid sort sields&lt;/P&gt;

&lt;P&gt;with:&lt;BR /&gt;
message="Found invalid sort fields"&lt;/P&gt;

&lt;P&gt;Ive tried several different options including this:&lt;BR /&gt;
index=java host=&lt;EM&gt;src&lt;/EM&gt; sourcetype=tomcat:src:server "Found invalid sort sields" |  rex mode=sed "s/\sFound\sinvalid\ssort\ssields/ message="\"Found invalid sort fields\""/g"&lt;/P&gt;

&lt;P&gt;But this errors:&lt;BR /&gt;
Error in 'rex' command: Failed to initialize sed. Failed to parse the replacement string.&lt;/P&gt;

&lt;P&gt;Any thoughts on how I can get around this?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:16:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279349#M84365</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-08T16:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD search inline question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279350#M84366</link>
      <description>&lt;P&gt;Try like this (run anywhere sample)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval _raw="2016-04-08 15:04:14,711 [_498147344979146612131995] priority=ERROR thread=http-nio-10010-exec-9 location=com.xxx.search.suggest.v3.impl Found invalid sort sields, invalidFields=eventDateLocal asc" | table _raw 
| rex mode=sed "s/(Found\sinvalid\ssort\ssields)/Message=\"\1\"/"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:56:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279350#M84366</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-08T16:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD search inline question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279351#M84367</link>
      <description>&lt;P&gt;So I took your above and modified my search from using:&lt;/P&gt;

&lt;P&gt;rex mode=sed "s/\sFound\sinvalid\ssort\ssields/ message="\"Found invalid sort fields\""/g"&lt;/P&gt;

&lt;P&gt;to use: &lt;BR /&gt;
rex mode=sed "s/(Found\sinvalid\ssort\ssields)/message=\"Found invalid sort fields\"/g"&lt;/P&gt;

&lt;P&gt;Works now&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 17:29:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279351#M84367</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-08T17:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD search inline question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279352#M84368</link>
      <description>&lt;P&gt;The parens around the search string capture the matched string. This is why he uses the &lt;CODE&gt;\1&lt;/CODE&gt; in the replace string. If your log sample really has &lt;EM&gt;sields&lt;/EM&gt; instead of &lt;EM&gt;fields&lt;/EM&gt; and you not only want to add message= to it, but also change the spelling the &lt;CODE&gt;\1&lt;/CODE&gt; can't be used. However, if the log sample really has &lt;STRONG&gt;fields&lt;/STRONG&gt; then the &lt;CODE&gt;\1&lt;/CODE&gt; should work dandy!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 17:54:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279352#M84368</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2016-04-08T17:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD search inline question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279353#M84369</link>
      <description>&lt;P&gt;Really? &lt;BR /&gt;
Cause I used this:&lt;BR /&gt;
index=java host=&lt;EM&gt;src&lt;/EM&gt; sourcetype=tomcat:src:server earliest=-4h "Found invalid sort sields"| rex mode=sed "s/(Found\sinvalid\ssort\ssields)/message=\"Found invalid sort fields\"/g"&lt;/P&gt;

&lt;P&gt;And got the results:&lt;BR /&gt;
2016-04-08 16:59:48,521 [_498840895039862628422332] priority=ERROR thread=http-nio-10010-exec-6 location=com.xxx.search.suggest.v3.impl message="Found invalid sort fields", invalidFields=eventDateLocal asc&lt;/P&gt;

&lt;P&gt;What makes you say it doesn't work?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 18:05:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279353#M84369</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-08T18:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD search inline question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279354#M84370</link>
      <description>&lt;P&gt;Removing the parens returns the same results as well&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 18:07:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279354#M84370</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-08T18:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD search inline question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279355#M84371</link>
      <description>&lt;P&gt;I did not say it does not work. I said the parentheses are used to capture the matched data, and the &lt;CODE&gt;\1&lt;/CODE&gt; returns that in the replace string. If you are going to use a literal replace string -- as you are showing you are doing, you don't need the parentheses or the &lt;CODE&gt;\1&lt;/CODE&gt;. I am kind of curious why your log entry has that mis-spelling of the word fields as &lt;EM&gt;sields&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 18:33:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279355#M84371</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2016-04-08T18:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD search inline question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279356#M84372</link>
      <description>&lt;P&gt;Sure sure, I understand. &lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 19:52:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SEDCMD-search-inline-question/m-p/279356#M84372</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-08T19:52:03Z</dc:date>
    </item>
  </channel>
</rss>

