<?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 Error in rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101513#M26225</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to extract fields using rex. I want to display graph according to guestname (kitoa01,kitoa05).&lt;/P&gt;

&lt;P&gt;The log file path is :&lt;/P&gt;

&lt;P&gt;C:\opt\app\samba\mnt\powersupply\kitoa01\KITOPS01&lt;/P&gt;

&lt;P&gt;C:\opt\app\samba\mnt\powersupply\kitoa05\KITOPS05&lt;/P&gt;

&lt;P&gt;And i have indexed data with host_segment=7. Bcoz KITOPS01,KITOPS05 are hostnames.If i am searching data by host,it is working fine.&lt;/P&gt;

&lt;P&gt;but i need to extract by guest name.I am trying this query:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="dummy" sourcetype="power_dummy" | rex field=source "(((?&amp;lt;kit&amp;gt;([^\]+))\)+?)" | search guest="$guestname$" |  timechart max(Power_consumption) by host&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;its giving me error : Error in 'rex' command: Encountered the following error while compiling the regex '&lt;CODE&gt;(((?&amp;lt;kit&amp;gt;([^\]+))\)+?)'&lt;/CODE&gt;: Regex: syntax error in subpattern name (missing terminator)&lt;/P&gt;</description>
    <pubDate>Fri, 13 May 2011 05:48:46 GMT</pubDate>
    <dc:creator>geetanjali</dc:creator>
    <dc:date>2011-05-13T05:48:46Z</dc:date>
    <item>
      <title>Error in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101513#M26225</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to extract fields using rex. I want to display graph according to guestname (kitoa01,kitoa05).&lt;/P&gt;

&lt;P&gt;The log file path is :&lt;/P&gt;

&lt;P&gt;C:\opt\app\samba\mnt\powersupply\kitoa01\KITOPS01&lt;/P&gt;

&lt;P&gt;C:\opt\app\samba\mnt\powersupply\kitoa05\KITOPS05&lt;/P&gt;

&lt;P&gt;And i have indexed data with host_segment=7. Bcoz KITOPS01,KITOPS05 are hostnames.If i am searching data by host,it is working fine.&lt;/P&gt;

&lt;P&gt;but i need to extract by guest name.I am trying this query:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="dummy" sourcetype="power_dummy" | rex field=source "(((?&amp;lt;kit&amp;gt;([^\]+))\)+?)" | search guest="$guestname$" |  timechart max(Power_consumption) by host&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;its giving me error : Error in 'rex' command: Encountered the following error while compiling the regex '&lt;CODE&gt;(((?&amp;lt;kit&amp;gt;([^\]+))\)+?)'&lt;/CODE&gt;: Regex: syntax error in subpattern name (missing terminator)&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 05:48:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101513#M26225</guid>
      <dc:creator>geetanjali</dc:creator>
      <dc:date>2011-05-13T05:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Error in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101514#M26226</link>
      <description>&lt;P&gt;I suspect that you meant to have backslashes in the rex instead of forward slashes, but that you used forward slashes because the answers site tends to swallow backslashes?  &lt;/P&gt;

&lt;P&gt;In the answers site you need to type two consecutive backslashes if you want the site to print a single backslash.  UNLESS the text is wrapped in backtick characters (`) or indented with 4 spaces. &lt;/P&gt;

&lt;P&gt;And the answer is somewhat similar in the search language -- in the &lt;CODE&gt;rex&lt;/CODE&gt; command and in the search language in general, you have to type in two consecutive backslash characters whenever you mean to send a single backslash character.   Hence the correct search to copy and paste should be: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="dummy" sourcetype="power_dummy" | rex field=source "(((?&amp;lt;kit&amp;gt;([^\\]+))\\)+?)" | search guest="$guestname$" | timechart max(Power_consumption) by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 May 2011 05:58:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101514#M26226</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-05-13T05:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Error in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101515#M26227</link>
      <description>&lt;P&gt;Yes. In actual path, there is backslash in path. i have used the same rex for extracting guest. but it is giving 0 matching result. &lt;/P&gt;

&lt;P&gt;I am not very much aware of regular expression. &lt;BR /&gt;
Please help.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 06:15:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101515#M26227</guid>
      <dc:creator>geetanjali</dc:creator>
      <dc:date>2011-05-13T06:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Error in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101516#M26228</link>
      <description>&lt;P&gt;Try again - it looks like if you indent the code sample, the answers site &lt;EM&gt;stops&lt;/EM&gt; requiring backslashes to be escaped.  So I had accidentally double-escaped the backslashes.  Try copying and pasting the search now.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 16:47:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101516#M26228</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-05-13T16:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error in rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101517#M26229</link>
      <description>&lt;P&gt;NOTE: I'm not positive but since it really sounded like you had backslashes in there instead of regular slashes, I took the liberty of editing your question to have backslashes in the search and in the error message from rex...&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2011 19:06:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-rex/m-p/101517#M26229</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-05-13T19:06:51Z</dc:date>
    </item>
  </channel>
</rss>

