<?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: How to escape all the possible special characters in a search string in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583170#M47780</link>
    <description>&lt;P&gt;Instead of trying to escape everything, could you not just modify the token so it is enclosed in quotes with embedded quotes escaped?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index_name sourcetype="sourcetype_name" $search|s$&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 01 Feb 2022 08:06:36 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-02-01T08:06:36Z</dc:date>
    <item>
      <title>How to escape all the possible special characters in a search string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583161#M47777</link>
      <description>&lt;P&gt;I have a dashboard which has two panels; one of them shows the errors and the count of how many times similar error has occurred. Another panel shows the details of the error when clicked on an error.&lt;/P&gt;&lt;P&gt;This error string sometimes has characters like &amp;lt;,&amp;gt;,\, etc. and splunk does not read them as string but characters, which results in error on the panel. I would like to use something which would escape all the possible characters in one go.&lt;/P&gt;&lt;P&gt;Currently, my query looks like this:&lt;/P&gt;&lt;P&gt;index=index_name sourcetype="sourcetype_name"&amp;nbsp;&lt;BR /&gt;[ | makeresults&lt;BR /&gt;| eval cleansearch=replace(replace("$search$", "&amp;lt;", "\&amp;lt;"), "&amp;gt;", "\&amp;gt;")&lt;BR /&gt;| return $cleansearch]&lt;/P&gt;&lt;P&gt;Is there anything more simpler that I could use that would escape all the possible characters that could cause an issue instead of replacing each character individually?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Feb 2022 05:21:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583161#M47777</guid>
      <dc:creator>NamrataRathore</dc:creator>
      <dc:date>2022-02-01T05:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all the possible special characters in a search string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583170#M47780</link>
      <description>&lt;P&gt;Instead of trying to escape everything, could you not just modify the token so it is enclosed in quotes with embedded quotes escaped?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index_name sourcetype="sourcetype_name" $search|s$&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Feb 2022 08:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583170#M47780</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-02-01T08:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all the possible special characters in a search string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583325#M47808</link>
      <description>&lt;P&gt;Hi ITWhisperer,&lt;/P&gt;&lt;P&gt;Thank you for replying. Above solution doesn't work for me. I am getting the same error as before: "Unable to parse the search: Comparator '&amp;lt;' has an invalid term on the left side."&lt;/P&gt;&lt;P&gt;My query also has split and substr as the error string is way too long and results in error. The whole query is:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index=index_name sourcetype="sourcetype_name"&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ | makeresults&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval cleansearch=replace(replace(substr(mvindex(split("$search$", ":00 - "),1), 0, 100) "&amp;lt;", "\&amp;lt;"), "&amp;gt;", "\&amp;gt;")."*"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| return $cleansearch]&lt;/SPAN&gt;&amp;nbsp;&lt;BR /&gt;which works but it only work for &amp;lt;,&amp;gt; operators.&lt;/P&gt;&lt;P&gt;I tried |s as you suggested but it doesn't work:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index=index_name sourcetype="sourcetype_name"&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ | makeresults&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval cleansearch=substr(mvindex(split("$search|s$", ":00 - "),1), 0, 100)."*"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| return $cleansearch]&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error string looks like this:&lt;BR /&gt;&amp;lt;r&amp;gt;2022-02-02 04:33:34 +11:00 - Serious: Very_long_error_string&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 07:06:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583325#M47808</guid>
      <dc:creator>NamrataRathore</dc:creator>
      <dc:date>2022-02-02T07:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all the possible special characters in a search string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583329#M47810</link>
      <description>&lt;P&gt;It would have helped if you had mentioned the split and substr to start with!&lt;/P&gt;&lt;P&gt;Try it like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=index_name sourcetype="sourcetype_name" 
[ | makeresults
| eval cleansearch=substr(mvindex(split("$search$", ":00 - "),1), 0, 100)."*"
| return $cleansearch
| format "" "" "" "" "" ""] &lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 02 Feb 2022 07:33:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583329#M47810</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-02-02T07:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all the possible special characters in a search string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583332#M47811</link>
      <description>&lt;P&gt;You shouldn't have to escape &amp;lt; and &amp;gt;. Simply set your token prefix and suffix to " to have quotes surround your search string.&lt;/P&gt;&lt;P&gt;Keep in mind that if you're editing the XML, you do need to substitute &amp;lt; and &amp;gt; with&amp;nbsp;&amp;amp;lt; and &amp;amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 07:37:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583332#M47811</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-02-02T07:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all the possible special characters in a search string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583351#M47813</link>
      <description>&lt;P&gt;This worked like a charm. Thank you so much!&amp;nbsp;&lt;/P&gt;&lt;P&gt;And could you please let me know how the format worked here? I am new to Splunk so just wanted to know.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 09:29:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-escape-all-the-possible-special-characters-in-a-search/m-p/583351#M47813</guid>
      <dc:creator>NamrataRathore</dc:creator>
      <dc:date>2022-02-02T09:29:22Z</dc:date>
    </item>
  </channel>
</rss>

