<?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 can I escape double quotes in a token to modify a search? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230185#M14289</link>
    <description>&lt;P&gt;In XML you can use &lt;CODE&gt;&amp;amp;quot;&lt;/CODE&gt; instead of &lt;STRONG&gt;"&lt;/STRONG&gt;. It's working for me&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;choice value="&amp;amp;quot; | append [ search eventtype=x sourcetype=y host=z | eval series=if(like(source, &amp;amp;quot;%vmstat_DB_%&amp;amp;quot;), &amp;amp;quot;CPU DB&amp;amp;quot;, source), | rename cpu_used as value | table _time series value ]&amp;amp;quot;"&amp;gt;ON&amp;lt;/choice&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 12 Jan 2016 15:14:09 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2016-01-12T15:14:09Z</dc:date>
    <item>
      <title>How can I escape double quotes in a token to modify a search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230184#M14288</link>
      <description>&lt;P&gt;I have a search which sometimes I want to do an append, and sometimes not - this should be driven by a checkbox in the GUI. The optional append looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| append [ search eventtype=x sourcetype=y host=z | eval series=if(like(source, "%vmstat_DB_%"), "CPU DB", source), | rename cpu_used as value | table _time series value ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have defined a checkbox like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt; input type="checkbox" token="CPU_IN_TPS" searchWhenChanged="true"&amp;gt;
        &amp;lt; choice value="
| append [ search eventtype=x sourcetype=y host=z | eval series=if(like(source, "%vmstat_DB_%"), "CPU DB", source), | rename cpu_used as value | table _time series value ]"&amp;gt;ON&amp;lt; /choice&amp;gt;
      &amp;lt; /input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And &lt;CODE&gt;$CPU_IN_TPS$&lt;/CODE&gt; goes at the end of my main search.&lt;/P&gt;

&lt;P&gt;My problem is that double quotes are not accepted inside a token value. Is there a way of escaping them? Should I be using a macro instead?&lt;/P&gt;

&lt;P&gt;Many thanks,&lt;BR /&gt;
John Raftery&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 15:05:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230184#M14288</guid>
      <dc:creator>johnraftery</dc:creator>
      <dc:date>2016-01-12T15:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I escape double quotes in a token to modify a search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230185#M14289</link>
      <description>&lt;P&gt;In XML you can use &lt;CODE&gt;&amp;amp;quot;&lt;/CODE&gt; instead of &lt;STRONG&gt;"&lt;/STRONG&gt;. It's working for me&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;choice value="&amp;amp;quot; | append [ search eventtype=x sourcetype=y host=z | eval series=if(like(source, &amp;amp;quot;%vmstat_DB_%&amp;amp;quot;), &amp;amp;quot;CPU DB&amp;amp;quot;, source), | rename cpu_used as value | table _time series value ]&amp;amp;quot;"&amp;gt;ON&amp;lt;/choice&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jan 2016 15:14:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230185#M14289</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-01-12T15:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I escape double quotes in a token to modify a search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230186#M14290</link>
      <description>&lt;P&gt;This solved the quote issue - thanks very much. Strangely, the commas seem to disappear in the search - I end up with &lt;BR /&gt;
eval series=if(like(source "%vmstat_DB_%") "CPU DB" source&lt;BR /&gt;
Did you have this as well?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230186#M14290</guid>
      <dc:creator>johnraftery</dc:creator>
      <dc:date>2020-09-29T08:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can I escape double quotes in a token to modify a search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230187#M14291</link>
      <description>&lt;P&gt;not really. Below dashboard works perfect&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;TEST&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="checkbox" token="field1" searchWhenChanged="true"&amp;gt;
      &amp;lt;choice value="| append [ |stats count| eval series=if(like(count, &amp;amp;quot;%vmstat_DB_%&amp;amp;quot;), &amp;amp;quot;CPU DB&amp;amp;quot;, count) | rename cpu_used as value | table _time series value ]"&amp;gt;Test&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Test $field1$&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;|stats count|eval count=100 $field1$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;0&amp;lt;/earliest&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jan 2016 16:22:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230187#M14291</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-01-12T16:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I escape double quotes in a token to modify a search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230188#M14292</link>
      <description>&lt;P&gt;I get an error when trying to use the fieldset node:&lt;BR /&gt;
XML Syntax Error: Row, on line=320, contains unknown node=fieldset on line=321.&lt;/P&gt;

&lt;P&gt;What does this node do?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 16:32:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230188#M14292</guid>
      <dc:creator>johnraftery</dc:creator>
      <dc:date>2016-01-12T16:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: How can I escape double quotes in a token to modify a search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230189#M14293</link>
      <description>&lt;P&gt;Never mind - I had the checkbox set up wrong. Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2016 16:39:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230189#M14293</guid>
      <dc:creator>johnraftery</dc:creator>
      <dc:date>2016-01-12T16:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I escape double quotes in a token to modify a search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230190#M14294</link>
      <description>&lt;P&gt;For the panel requiring the double quotes to be escaped (\"), add:&lt;BR /&gt;
|rex mode=sed field=FIELD_REQUIRING_ESCAPES "s/\"/"\\""/g"&lt;/P&gt;

&lt;P&gt;It's using a Linux sed equivalent to replace every occurrence of " (\") with \" ("\\""). Different than Linux syntax, but it's working for me...&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:35:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/230190#M14294</guid>
      <dc:creator>kgtardiff</dc:creator>
      <dc:date>2020-09-29T12:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I escape double quotes in a token to modify a search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/673131#M55117</link>
      <description>&lt;P&gt;You can use a token modifier |s to escape double quotes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$token$&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;$token|s$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value of the tokens get parsed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;asdf="asdf"&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;"asdf=\"asdf\""&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, this also adds double quotes around it, which makes this modifier useless in all my work.&amp;nbsp; I would have preferred only having 1 effect per modifier that can stack with others for those that want both, but this might work for others.&lt;/P&gt;&lt;P&gt;The modifiers for tokens inside of alert action email bodies may not be available, but it will work in dashboards.&lt;/P&gt;&lt;P&gt;Source:&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.1.2/Viz/tokens#Syntax_to_consume_tokens" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.1.2/Viz/tokens#Syntax_to_consume_tokens&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 14:14:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-escape-double-quotes-in-a-token-to-modify-a-search/m-p/673131#M55117</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2024-01-03T14:14:57Z</dc:date>
    </item>
  </channel>
</rss>

