<?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: Eval string until character in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33407#M178287</link>
    <description>&lt;P&gt;Ok, this allows me to count by those which don't have "&lt;EM&gt;@". Well I want to coun by them too you. I want ChangeCurrentObj&lt;/EM&gt;@Anonymous and ChangeCurrentObj_@blabla2 and ChangeCurrentObj_@blabla3 to be rewritten as ChangeCurrentObj, and then count by them too&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 14:34:07 GMT</pubDate>
    <dc:creator>TiagoMatos</dc:creator>
    <dc:date>2020-09-28T14:34:07Z</dc:date>
    <item>
      <title>Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33390#M178270</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I'm having strings that are very specific. I'm trying to agregate them, so what I want is just to keep the string until "_@" appear. I don't understand yet Perl expression syntax. Can anyone help?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 14:35:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33390#M178270</guid>
      <dc:creator>TiagoMatos</dc:creator>
      <dc:date>2013-08-13T14:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33391#M178271</link>
      <description>&lt;P&gt;please provide a few sample events. This could be a start;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;rex field=my_long_string "(?&amp;lt;new_field&amp;gt;.+?)_@"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 15:09:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33391#M178271</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-13T15:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33392#M178272</link>
      <description>&lt;P&gt;I have SWEMethods with values like this one:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;ChangeCurrentObj_@0*0*10*0*5*Group0*9*UIPropInd1*Y11*CxGroupName10*VII. VPN16*RequireMoreChild0*11*Parent Path9*1-KR600AC4*Type5*Group12*TemplateName23*eCfgGroupStandardJS.swt8*Selected1*N12*.MasterGroup17*VII. Fixo &amp;amp;amp&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I want to perform a count such as this:&lt;/P&gt;

&lt;P&gt;I want to count by method, but everything after &lt;CODE&gt;_@&lt;/CODE&gt; is just a specification. So I want something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="pt_app_siebel" NOT error*| eval X =replace(SWEMethod, "^(\w+)_@.+$",  "\1" ) | timechart usenull=F limit=0 span=1s count by SWEMethod | table SWEMethod&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Hope it helps&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 15:19:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33392#M178272</guid>
      <dc:creator>TiagoMatos</dc:creator>
      <dc:date>2013-08-13T15:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33393#M178273</link>
      <description>&lt;P&gt;&lt;CODE&gt;index=pt_app_siebel | rex field=SWEMethod "^(?&amp;lt;X&amp;gt;\w+)_@" | timechart etc etc blah blah&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;??&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 15:34:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33393#M178273</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-13T15:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33394#M178274</link>
      <description>&lt;P&gt;I want to replace every character right to the "_@" by nothing, so that it has to be eval with a replace&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 15:43:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33394#M178274</guid>
      <dc:creator>TiagoMatos</dc:creator>
      <dc:date>2013-08-13T15:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33395#M178275</link>
      <description>&lt;P&gt;Why don't you rex everything after the &lt;EM&gt;@?&lt;BR /&gt;
 rex field=SWEMethod "^&lt;/EM&gt;@(?&lt;X&gt;.*)"&lt;/X&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 17:19:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33395#M178275</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-08-13T17:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33396#M178276</link>
      <description>&lt;P&gt;TiagoMatos: my suggestion creates a field called 'X' which contains the beginning of the SWEMethod up to &lt;CODE&gt;_@&lt;/CODE&gt;. Use the field 'X' instead of 'SWEMethod' in the subsequent search commands.&lt;/P&gt;

&lt;P&gt;lukejadamec: that would not work. The field does not start with '@'. And TiagoMatos want everything before &lt;CODE&gt;_@&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 20:36:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33396#M178276</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-13T20:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33397#M178277</link>
      <description>&lt;P&gt;I'm confused.  First you say you "want is just to keep the string until "&lt;EM&gt;@" appear", then you say you "want to replace every character right to the "&lt;/EM&gt;@" by nothing".&lt;BR /&gt;&lt;BR /&gt;
In my world, replace before @ by nothing means keep everything after @.&lt;BR /&gt;&lt;BR /&gt;
If you want to have both before and after the @, then rex both.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 21:32:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33397#M178277</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-08-13T21:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33398#M178278</link>
      <description>&lt;P&gt;&lt;CODE&gt;left-side-to-keep_@right-side-to-skip&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;still confusing?&lt;/P&gt;

&lt;P&gt;also, "&lt;CODE&gt;^@&lt;/CODE&gt;" would require that the string/line &lt;EM&gt;starts&lt;/EM&gt; with '@', which it does not. &lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2013 07:42:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33398#M178278</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-14T07:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33399#M178279</link>
      <description>&lt;P&gt;Your question isn't exactly clear. Could you perhaps give a bit of sample data and say what you want to skip and what you want to keep?&lt;/P&gt;

&lt;P&gt;Assuming that Kristian's example is correct, you could use the following regex with a positive lookahead.&lt;BR /&gt;
".*?(?=_@)"&lt;/P&gt;

&lt;P&gt;In the example of "foo_@bar", the above regex would only select "foo" and ignore the "_@bar". You can use this regex in Splunk using the rex command.&lt;/P&gt;

&lt;P&gt;edit: Based on your comment, I ran the following regex through Regexr (&lt;A href="http://gskinner.com/RegExr/" target="_blank"&gt;http://gskinner.com/RegExr/&lt;/A&gt;) for you:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;(?&amp;lt;=^SWEMethod=).*?(?=_@)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Based on your sample, this will select only ChangeCurrentObj. This regex will only work if the data starts with "SWEMethod=". If this isn't the case, a poor man's replacement could be:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;(?&amp;lt;=\w=).*?(?=_@)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;but I recommend working it out further.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:33:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33399#M178279</guid>
      <dc:creator>lcrielaa</dc:creator>
      <dc:date>2020-09-28T14:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33400#M178280</link>
      <description>&lt;P&gt;Kristian.kolb, that is exactly what I want. I want to use replace to keep left-side in the string. I need to identify those that have "_@" and ignore the right side of it&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2013 08:17:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33400#M178280</guid>
      <dc:creator>TiagoMatos</dc:creator>
      <dc:date>2013-08-14T08:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33401#M178281</link>
      <description>&lt;P&gt;One Example is this one. The field is SWEMethod, so &lt;/P&gt;

&lt;P&gt;SWEMethod=ChangeCurrentObj_@0*0*10*0*5*Group0*9*UIPropInd1*Y11*CxGroupName10*VII.   VPN16*RequireMoreChild0*11*Parent Path9*1-CWMQIJW4*Type5*Group12*TemplateName23*eCfgGroupStandardJS.swt8*Selected1*N12*.MasterGroup17*VII.   Fixo &amp;amp;amp"&lt;/P&gt;

&lt;P&gt;What I want is to use replace to keep just "ChangeCurrentObj", and nothing more than that&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:33:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33401#M178281</guid>
      <dc:creator>TiagoMatos</dc:creator>
      <dc:date>2020-09-28T14:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33402#M178282</link>
      <description>&lt;P&gt;TiagaMatos: did you try what i outlined in comments #1, #3 and #6?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2013 11:13:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33402#M178282</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-14T11:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33403#M178283</link>
      <description>&lt;P&gt;I can identify the "_@" elements, but I didn't yet figure out how to replace the right side with nothing, so rex is not enough&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2013 11:20:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33403#M178283</guid>
      <dc:creator>TiagoMatos</dc:creator>
      <dc:date>2013-08-14T11:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33404#M178284</link>
      <description>&lt;P&gt;If you use rex to grab Only the left side, what do you think will remain on the right side?&lt;BR /&gt;
Are you trying to remove the raw data?&lt;BR /&gt;
Why do you think you need replace?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2013 13:36:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33404#M178284</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-08-14T13:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33405#M178285</link>
      <description>&lt;P&gt;I need replace because I want to use timechart count by SWEMethod, with SWEMethod aggregated you see?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2013 13:43:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33405#M178285</guid>
      <dc:creator>TiagoMatos</dc:creator>
      <dc:date>2013-08-14T13:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33406#M178286</link>
      <description>&lt;P&gt;OK. once again. &lt;/P&gt;

&lt;P&gt;You have a field called SWEMethod. It contains a long string, with a delimeter (&lt;CODE&gt;_@&lt;/CODE&gt;) in the middle somewhere. You want to use everything before the delimeter for some reporting purposes. OK?&lt;/P&gt;

&lt;P&gt;Use the field extraction methods shown to you, which will create a new field called 'X'. Then - use 'X' instead of 'SWEMethod' for the remainder of the query. It is that simple, e.g.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=pt_app_siebel | rex field=SWEMethod "^(?&amp;lt;X&amp;gt;\w+)_@" | timechart span=5min count(X) values(X)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;SWEMethod will still have its old (long) value, but that does not matter, since you're not using it.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2013 14:20:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33406#M178286</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-14T14:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33407#M178287</link>
      <description>&lt;P&gt;Ok, this allows me to count by those which don't have "&lt;EM&gt;@". Well I want to coun by them too you. I want ChangeCurrentObj&lt;/EM&gt;@Anonymous and ChangeCurrentObj_@blabla2 and ChangeCurrentObj_@blabla3 to be rewritten as ChangeCurrentObj, and then count by them too&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:34:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33407#M178287</guid>
      <dc:creator>TiagoMatos</dc:creator>
      <dc:date>2020-09-28T14:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Eval string until character</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33408#M178288</link>
      <description>&lt;P&gt;Perhaps I can refer you to some pieces of the documentation that might prove useful.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Tutorial/Usefieldstosearch"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Tutorial/Usefieldstosearch&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Aboutfields"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Aboutfields&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2013 14:59:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-string-until-character/m-p/33408#M178288</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-14T14:59:21Z</dc:date>
    </item>
  </channel>
</rss>

