<?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 How to delete everything before and including string, using regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/562902#M196135</link>
    <description>&lt;P&gt;Dear Community, I have the following search query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="myIndex" 
host="myHost" 
source="mySource.log" 
2021081105302743 
"started with profile"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above gives me the following result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Progam has run, 2021081105302743 started with profile TEST_PROFILE_01&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to remove everything before&amp;nbsp;&lt;STRONG&gt;TEST_PROFILE_01&amp;nbsp;&lt;/STRONG&gt;, giving me just the profile. Beforehand I do not know what profile is used. Therefore I guess what I want is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Remove everything before "profile"&lt;/LI&gt;&lt;LI&gt;Also remove "profile"&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Then, I want to display the profile in a "Single Value".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used the below in a table before, but now that I am using Single Value, I don't know which field to use. Also if I use a string instead of the # below in the table, it won't work.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval _raw = replace(_raw,"^[^#]*#", "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;When using a Single Value Panel, what field do I use in the above search at the position _raw (what to replace it with)? When I search for the data as shown in the query located at the top, the data is shown in the "Event" field. Is this the field I should use?&lt;/LI&gt;&lt;LI&gt;At the position of the # I would like to use "profile", but I don't know how to edit the regex accordingly.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I could use some help on this matter. Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Aug 2021 11:52:29 GMT</pubDate>
    <dc:creator>Bleepie</dc:creator>
    <dc:date>2021-08-11T11:52:29Z</dc:date>
    <item>
      <title>How to delete everything before and including string, using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/562902#M196135</link>
      <description>&lt;P&gt;Dear Community, I have the following search query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="myIndex" 
host="myHost" 
source="mySource.log" 
2021081105302743 
"started with profile"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above gives me the following result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Progam has run, 2021081105302743 started with profile TEST_PROFILE_01&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to remove everything before&amp;nbsp;&lt;STRONG&gt;TEST_PROFILE_01&amp;nbsp;&lt;/STRONG&gt;, giving me just the profile. Beforehand I do not know what profile is used. Therefore I guess what I want is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Remove everything before "profile"&lt;/LI&gt;&lt;LI&gt;Also remove "profile"&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Then, I want to display the profile in a "Single Value".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used the below in a table before, but now that I am using Single Value, I don't know which field to use. Also if I use a string instead of the # below in the table, it won't work.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval _raw = replace(_raw,"^[^#]*#", "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;When using a Single Value Panel, what field do I use in the above search at the position _raw (what to replace it with)? When I search for the data as shown in the query located at the top, the data is shown in the "Event" field. Is this the field I should use?&lt;/LI&gt;&lt;LI&gt;At the position of the # I would like to use "profile", but I don't know how to edit the regex accordingly.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I could use some help on this matter. Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 11:52:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/562902#M196135</guid>
      <dc:creator>Bleepie</dc:creator>
      <dc:date>2021-08-11T11:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete everything before and including string, using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/562907#M196136</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Is it enough that you just get profile name from _raw instead of alter _raw? If this is ok, then you can use the next rex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;....
| rex "started with profile (?&amp;lt;profile&amp;gt;[^\n]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And if you also want replace raw then you can add this to next line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| eval _raw = profile&lt;/LI-CODE&gt;&lt;P&gt;r. Ismo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 12:14:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/562907#M196136</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-08-11T12:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete everything before and including string, using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/562909#M196137</link>
      <description>&lt;P&gt;Problem is, I am not sure if I am using _raw here or not (In a Single Value Panel). When applying the above in just a search (regardless of a panel) I still get the full search results, where I am just expecting the name of the profile (I have marked some information in red that is not supposed to be shared):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="splunkie.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15525i67EFDB55161E67B2/image-size/large?v=v2&amp;amp;px=999" role="button" title="splunkie.png" alt="splunkie.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the regex you use &amp;lt;profile&amp;gt; as I field I think? I am not too sure. But even when replacing &amp;lt;profile&amp;gt;&amp;nbsp; with &amp;lt;event&amp;gt; it still shows everything.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 12:23:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/562909#M196137</guid>
      <dc:creator>Bleepie</dc:creator>
      <dc:date>2021-08-11T12:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete everything before and including string, using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/563043#M196165</link>
      <description>&lt;P&gt;If you want to switch _raw also on displayed event then you must do it on props.conf. But I think that still you can see it if you select "Event Actions" -&amp;gt; Show Source. The only way how you can really get rid of it is remove it before you indexing it.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 09:44:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/563043#M196165</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-08-12T09:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete everything before and including string, using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/563045#M196166</link>
      <description>&lt;P&gt;Hi Soutame, thanks for your reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got it working thanks to one of my colleagues. We applied the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=_raw "profile\s(?&amp;lt;whatever&amp;gt;[^\s\r]+)"
| stats count by whatever | fields - count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 09:47:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-delete-everything-before-and-including-string-using-regex/m-p/563045#M196166</guid>
      <dc:creator>Bleepie</dc:creator>
      <dc:date>2021-08-12T09:47:49Z</dc:date>
    </item>
  </channel>
</rss>

