<?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: Remove string from field using REX in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Remove-string-from-field-using-REX/m-p/750321#M242289</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/309196"&gt;@Splunkie&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you want this to affect the raw data (e.g when its indexed) or do you want the original string to exist in the data but also have a field which has it without the suffix?&lt;/P&gt;&lt;P&gt;You could do the following at search time:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=Username_Field mode=sed "s/ sophos_event_input$//" &lt;/LI-CODE&gt;&lt;P&gt;(See&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Alternatively you could use a REPLACE function:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval cleaned_Username=REPLACE(Username_Field," sophos_event_input","")&lt;/LI-CODE&gt;&lt;P&gt;You could also make this an automatic calculated field so that you dont need to include it in your SPL:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1753263245091.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39730i6E84BF4CAB2CA201/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1753263245091.png" alt="livehybrid_0-1753263245091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want this to be replaced in the _raw event at index time then you need to deploy a props.conf file within a custom app to your HF or Indexers (whichever the data lands on first) with something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# props.conf #
[yourSourcetype]
SEDCMD-removeSophosSuffix = "s/ sophos_event_input//g"&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jul 2025 09:36:46 GMT</pubDate>
    <dc:creator>livehybrid</dc:creator>
    <dc:date>2025-07-23T09:36:46Z</dc:date>
    <item>
      <title>Remove string from field using REX</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-string-from-field-using-REX/m-p/750318#M242287</link>
      <description>&lt;P&gt;I am trying to remove a field which&amp;nbsp; has a suffix of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;sophos_event_input&amp;nbsp;&lt;/STRONG&gt;after the username. Example&lt;/P&gt;&lt;P&gt;Username_Field&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Joe-Smith, Adams sophos_event_input&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Jane-Doe, Smith&amp;nbsp;sophos_event_input&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I would like to change the Username field to only contain the users name, Example&lt;/P&gt;&lt;P&gt;Username_Field&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Joe-Smith, Adams&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Jane-Doe, Smith&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Basically I want to get rid of the&amp;nbsp;&lt;STRONG&gt;sophos_event_inpu&lt;/STRONG&gt;t suffix.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;How will I go about this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 09:00:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-string-from-field-using-REX/m-p/750318#M242287</guid>
      <dc:creator>Splunkie</dc:creator>
      <dc:date>2025-07-23T09:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Remove string from field using REX</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-string-from-field-using-REX/m-p/750319#M242288</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/309196"&gt;@Splunkie&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;do you want to do this at index time, recording the modified events or at search time (only in visualization)?&lt;/P&gt;&lt;P&gt;if at search time, you can use a regex in your searches like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/sophos_event_input/ /g"&lt;/LI-CODE&gt;&lt;P&gt;if at index time, you should put in the props.conf:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[&amp;lt;your_sourcetype&amp;gt;]
SEDCMD = "s/sophos_event_input/ /g"&lt;/LI-CODE&gt;&lt;P&gt;This conf file must be located in the first full Splunk instance where data pass through, in other words in the first Heavy Forwarder (if present) or otherwise on the Indexers.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 09:08:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-string-from-field-using-REX/m-p/750319#M242288</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2025-07-23T09:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove string from field using REX</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-string-from-field-using-REX/m-p/750321#M242289</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/309196"&gt;@Splunkie&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you want this to affect the raw data (e.g when its indexed) or do you want the original string to exist in the data but also have a field which has it without the suffix?&lt;/P&gt;&lt;P&gt;You could do the following at search time:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=Username_Field mode=sed "s/ sophos_event_input$//" &lt;/LI-CODE&gt;&lt;P&gt;(See&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Alternatively you could use a REPLACE function:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval cleaned_Username=REPLACE(Username_Field," sophos_event_input","")&lt;/LI-CODE&gt;&lt;P&gt;You could also make this an automatic calculated field so that you dont need to include it in your SPL:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1753263245091.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/39730i6E84BF4CAB2CA201/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1753263245091.png" alt="livehybrid_0-1753263245091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want this to be replaced in the _raw event at index time then you need to deploy a props.conf file within a custom app to your HF or Indexers (whichever the data lands on first) with something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# props.conf #
[yourSourcetype]
SEDCMD-removeSophosSuffix = "s/ sophos_event_input//g"&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 09:36:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-string-from-field-using-REX/m-p/750321#M242289</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-07-23T09:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Remove string from field using REX</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-string-from-field-using-REX/m-p/750325#M242290</link>
      <description>&lt;P&gt;Thanks livehybrid,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first option worked perfectly. I only wanted the field to be sanitized at search time and the first option does that.&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 10:43:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-string-from-field-using-REX/m-p/750325#M242290</guid>
      <dc:creator>Splunkie</dc:creator>
      <dc:date>2025-07-23T10:43:04Z</dc:date>
    </item>
  </channel>
</rss>

