<?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: Regex replace field text in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527011#M148754</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227231"&gt;@g_paternicola&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;why didn't you&amp;nbsp; try your search? it seems to be almost correct:&lt;/P&gt;&lt;P&gt;you have only to escape special chars as ():&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eventtype=zyxel_user sourcetype="zyxel-fw" msg="Failed login attempt to Device from *"
| stats count by msg
| rex field=msg mode=sed "s/Failed login attempt to Device from ssh \(incorrect password or inexistent username\)/SSH/g"&lt;/LI-CODE&gt;&lt;P&gt;You could also explore the replace command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Replace" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Replace)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 29 Oct 2020 07:36:02 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-10-29T07:36:02Z</dc:date>
    <item>
      <title>Regex replace field text</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527010#M148753</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I was wondering if this kind of search is possible. I want to replace the text from my search which looks like this:&lt;/P&gt;&lt;P&gt;eventtype=zyxel_user sourcetype="zyxel-fw" msg="Failed login attempt to Device from *"&lt;BR /&gt;| stats count by msg&lt;BR /&gt;| rex field=msg mode=sed "s/'Failed login attempt to Device from ssh (incorrect password or inexistent username)'/SSH/g"&lt;/P&gt;&lt;P&gt;Basically, I want to get instead of this long string&amp;nbsp; (Failed login attempt to Device.....) just SSH, so I can create a Pie Chart with this information.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that possible?&lt;/P&gt;&lt;P&gt;Thank you very much for helping me!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 07:29:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527010#M148753</guid>
      <dc:creator>g_paternicola</dc:creator>
      <dc:date>2020-10-29T07:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regex replace field text</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527011#M148754</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227231"&gt;@g_paternicola&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;why didn't you&amp;nbsp; try your search? it seems to be almost correct:&lt;/P&gt;&lt;P&gt;you have only to escape special chars as ():&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eventtype=zyxel_user sourcetype="zyxel-fw" msg="Failed login attempt to Device from *"
| stats count by msg
| rex field=msg mode=sed "s/Failed login attempt to Device from ssh \(incorrect password or inexistent username\)/SSH/g"&lt;/LI-CODE&gt;&lt;P&gt;You could also explore the replace command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Replace" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Replace)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 07:36:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527011#M148754</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-29T07:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regex replace field text</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527012#M148755</link>
      <description>&lt;P&gt;Hi Giuseppe, my name is also Giuseppe &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I didn't thought about search, thank you! Ohh man, I tried to escape, but I put just one \ at the beginning and not also at the end.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just in case I have more of this kind of strings, do I also have to put for each one (e.g. FTP, HTTP, etc..) a different sed command?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 07:47:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527012#M148755</guid>
      <dc:creator>g_paternicola</dc:creator>
      <dc:date>2020-10-29T07:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regex replace field text</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527015#M148756</link>
      <description>&lt;P&gt;Hi Giuseppe,&lt;/P&gt;&lt;P&gt;it's a pleasure to know you!&lt;/P&gt;&lt;P&gt;Anyway, if you have to replace many strings, you could create a lookup containing all these pairs for transformations and use it with the lookup command.&lt;/P&gt;&lt;P&gt;I don't like it, but you could also create an automatic lookup so everytime&amp;nbsp; you have there strings they are automatically changed.&lt;/P&gt;&lt;P&gt;Ciao Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: if you're italian, there's finally a Splunk User Group also in Italy;&lt;/P&gt;&lt;P&gt;Karma Points are appreciated ;-).&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:16:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527015#M148756</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-10-29T08:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex replace field text</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527018#M148758</link>
      <description>&lt;P&gt;Yes, I could use a lookup command but for now I'm gonna use the replace command :). But in the future if the results are gonna be bigger and bigger with more than only ssh, ftp and http, then yes, I will use the lookup command in order to automate it... thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:22:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-replace-field-text/m-p/527018#M148758</guid>
      <dc:creator>g_paternicola</dc:creator>
      <dc:date>2020-10-29T08:22:04Z</dc:date>
    </item>
  </channel>
</rss>

