<?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: Escaping control codes in HTTP Request Templates in Splunk AppDynamics</title>
    <link>https://community.splunk.com/t5/Splunk-AppDynamics/Escaping-control-codes-in-HTTP-Request-Templates/m-p/737889#M10650</link>
    <description>&lt;P&gt;Hi There&lt;/P&gt;

&lt;P&gt;We have done the following in one of our templates, to ensure that the Quotes and line breaks etc. are replaced by other characters. We used *. You can modify and replace it with whatever you require.&lt;/P&gt;

&lt;P&gt;You can then add as many processing steps as needed at the start of the template, and then use the final processed message that is left over into your template.&lt;/P&gt;


&lt;P&gt;#set ($em = ${latestEvent.eventMessage.replace('"','*')})&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;b&amp;gt;', '*') )&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;/b&amp;gt;', '*') )&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;br&amp;gt;', ' ') )&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;{&lt;BR /&gt;"event_name": "${latestEvent.displayName}",&lt;BR /&gt;"event_Message":"$em",&lt;BR /&gt;}&lt;/P&gt;

&lt;P&gt;Otherwise you can remove the values completed as below&lt;/P&gt;

&lt;P&gt;#set ($em = ${latestEvent.eventMessage.replace('"','')})&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;b&amp;gt;', '') )&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;/b&amp;gt;', '') )&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;br&amp;gt;', '') )&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;{&lt;BR /&gt;"event_name": "${latestEvent.displayName}",&lt;BR /&gt;"event_Message":"$em",&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Sun, 06 Jun 2021 12:39:38 GMT</pubDate>
    <dc:creator>Morelz</dc:creator>
    <dc:date>2021-06-06T12:39:38Z</dc:date>
    <item>
      <title>Escaping control codes in HTTP Request Templates</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Escaping-control-codes-in-HTTP-Request-Templates/m-p/737886#M10647</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I'm trying to pass Appdynamics error data to Opsgenie using the HTTP Request Templates to format it in JSON.&lt;/P&gt;&lt;P&gt;My simplest template is :&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"event_name": "${latestEvent.displayName}",&lt;BR /&gt;"event_Message":"${latestEvent.eventMessage}",&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;But this is erroring at Opsgenie because there's a Line Feed in the event message :&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The content is not a valid json. Reason: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value at [Source: (String)"{ "event_name": "Business Transaction Error", "event_Message":"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Is there an easy way to escape/replace this in the template?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Doug McGibbon&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 21:07:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Escaping-control-codes-in-HTTP-Request-Templates/m-p/737886#M10647</guid>
      <dc:creator>Douglas_McGibbo</dc:creator>
      <dc:date>2021-06-03T21:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping control codes in HTTP Request Templates</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Escaping-control-codes-in-HTTP-Request-Templates/m-p/737887#M10648</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.appdynamics.com/t5/user/viewprofilepage/user-id/44371"&gt;@Douglas.McGibbon&lt;/A&gt;,&lt;/P&gt;

&lt;P&gt;An existing Community post,&amp;nbsp;&lt;A href="https://community.appdynamics.com/t5/Controller-SaaS-On-Premises/Escaped-double-quotes-in-HTTP-template/m-p/28165#U28165" class="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;Escaped double quotes in HTTP template&lt;/A&gt;&amp;nbsp;links to this reference guide:&amp;nbsp;&lt;A href="https://velocity.apache.org/tools/2.0/apidocs/org/apache/velocity/tools/generic/EscapeTool.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://velocity.apache.org/tools/2.0/apidocs/org/apache/velocity/tools/generic/EscapeTool.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Please do let me know if you find the post or the reference guide helpful. Since this is a peer-to-peer community, if you happen to find a solution, please come back and share it as a reply to your post. This helps keep the knowledge sharing going forward.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 16:25:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Escaping-control-codes-in-HTTP-Request-Templates/m-p/737887#M10648</guid>
      <dc:creator>iamryan</dc:creator>
      <dc:date>2021-06-04T16:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping control codes in HTTP Request Templates</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Escaping-control-codes-in-HTTP-Request-Templates/m-p/737888#M10649</link>
      <description>&lt;P&gt;Yes, I found that post and the guide, but it's not at all clear. And replacing one character with another is much easier than trying to get rid of a control character.&amp;nbsp; I've already spent several hours trying to do this in various ways, to no avail.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 19:51:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Escaping-control-codes-in-HTTP-Request-Templates/m-p/737888#M10649</guid>
      <dc:creator>Douglas_McGibbo</dc:creator>
      <dc:date>2021-06-04T19:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping control codes in HTTP Request Templates</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Escaping-control-codes-in-HTTP-Request-Templates/m-p/737889#M10650</link>
      <description>&lt;P&gt;Hi There&lt;/P&gt;

&lt;P&gt;We have done the following in one of our templates, to ensure that the Quotes and line breaks etc. are replaced by other characters. We used *. You can modify and replace it with whatever you require.&lt;/P&gt;

&lt;P&gt;You can then add as many processing steps as needed at the start of the template, and then use the final processed message that is left over into your template.&lt;/P&gt;


&lt;P&gt;#set ($em = ${latestEvent.eventMessage.replace('"','*')})&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;b&amp;gt;', '*') )&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;/b&amp;gt;', '*') )&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;br&amp;gt;', ' ') )&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;{&lt;BR /&gt;"event_name": "${latestEvent.displayName}",&lt;BR /&gt;"event_Message":"$em",&lt;BR /&gt;}&lt;/P&gt;

&lt;P&gt;Otherwise you can remove the values completed as below&lt;/P&gt;

&lt;P&gt;#set ($em = ${latestEvent.eventMessage.replace('"','')})&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;b&amp;gt;', '') )&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;/b&amp;gt;', '') )&lt;BR /&gt;#set ( $em = $em.replace('&amp;lt;br&amp;gt;', '') )&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;{&lt;BR /&gt;"event_name": "${latestEvent.displayName}",&lt;BR /&gt;"event_Message":"$em",&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jun 2021 12:39:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Escaping-control-codes-in-HTTP-Request-Templates/m-p/737889#M10650</guid>
      <dc:creator>Morelz</dc:creator>
      <dc:date>2021-06-06T12:39:38Z</dc:date>
    </item>
  </channel>
</rss>

