<?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 is linebreaking of events configured when receiving XML logs via REST input? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153314#M13853</link>
    <description>&lt;P&gt;Can you post an example of the full XML you receive. I can then help you with a sample custom response handler.&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jun 2015 00:40:50 GMT</pubDate>
    <dc:creator>Damien_Dallimor</dc:creator>
    <dc:date>2015-06-11T00:40:50Z</dc:date>
    <item>
      <title>How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153312#M13851</link>
      <description>&lt;P&gt;I am new to REST inputs and am having a very basic problem that I do not see discussed before.  I am using http &lt;CODE&gt;GET&lt;/CODE&gt; and &lt;CODE&gt;xml&lt;/CODE&gt; for &lt;CODE&gt;Response type&lt;/CODE&gt;.  I am receiving the response just fine but only as 1 giant event.  I would like to split events at the "&amp;lt;alarm&amp;gt;" tag (ending at "&amp;lt;/alarm&amp;gt;") but I do not see any way to configure this.  On a lark, I went ahead and put a &lt;CODE&gt;props.conf&lt;/CODE&gt; file in the same app directory as this input with the normal settings that would work for a file-based input but they have no effect.  How is &lt;CODE&gt;linbreaking&lt;/CODE&gt; of events controlled for REST inputs?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2015 20:10:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153312#M13851</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-10T20:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153313#M13852</link>
      <description>&lt;P&gt;This is lightly documented in the documentation in the section &lt;STRONG&gt;Custom Response Handlers&lt;/STRONG&gt;.  The response handlers can be found in the bin directory in a file call &lt;STRONG&gt;responsehandlers.py&lt;/STRONG&gt;.  By the Modular input use DefaultResponseHandler which just pass the REST response to STDOUT.  You can change it to any of the ones find the file by added the following setting to the stanza of your input, &lt;EM&gt;response_handler= &amp;lt;class&amp;gt;&lt;/EM&gt;.  class is just one of the classes from &lt;STRONG&gt;responsehandlers.py&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;From the sounds of it your REST response gives you multiple events in the message which you need to split or else it comes in as one giant event.  Looking at &lt;STRONG&gt;responsehandlers.py&lt;/STRONG&gt; it looks like you will have to write a little bit of python which should take about 15 lines of code.&lt;/P&gt;

&lt;P&gt;Not know how your raw data looks I might write something like this.  This was not tested as just wrote of the hip.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class AlarmResponseHandler:

  def __init__(self,**args):
    pass

  def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
    #for each line in response.  Assuming it reads like a text file with new line char returns
    for line in raw_response_output:
      # if ',/alarm&amp;gt;' in the line end of event
      if '&amp;lt;/alarm&amp;gt;' in line:
        event = event += line
        print_xml_stream(event)
        # clear event for new event
        event = None
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jun 2015 22:27:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153313#M13852</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2015-06-10T22:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153314#M13853</link>
      <description>&lt;P&gt;Can you post an example of the full XML you receive. I can then help you with a sample custom response handler.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 00:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153314#M13853</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-06-11T00:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153315#M13854</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;&amp;lt;alarm-list&amp;gt;
&amp;lt;alarm&amp;gt;
&amp;lt;assignedBy/&amp;gt;
&amp;lt;assignedTo/&amp;gt;
&amp;lt;custom1/&amp;gt;
&amp;lt;custom2/&amp;gt;
&amp;lt;custom3/&amp;gt;
&amp;lt;custom4/&amp;gt;
&amp;lt;custom5/&amp;gt;
&amp;lt;devId&amp;gt;D344459B39C33B452C53464089C59E78B&amp;lt;/devId&amp;gt;
&amp;lt;domain&amp;gt;Place&amp;lt;/domain&amp;gt;
&amp;lt;hostname&amp;gt;name&amp;lt;/hostname&amp;gt;
&amp;lt;hub&amp;gt;name&amp;lt;/hub&amp;gt;
&amp;lt;id&amp;gt;ZC40864030-00086&amp;lt;/id&amp;gt;
&amp;lt;level&amp;gt;2&amp;lt;/level&amp;gt;
&amp;lt;message&amp;gt;
ssss.exe: Process ssss.exe is not running
&amp;lt;/message&amp;gt;
&amp;lt;metId&amp;gt;MF66466D228CC0462DB58C5CA12D2C789&amp;lt;/metId&amp;gt;
&amp;lt;nas&amp;gt;servername&amp;lt;/nas&amp;gt;
&amp;lt;origin&amp;gt;servername&amp;lt;/origin&amp;gt;
&amp;lt;prevLevel&amp;gt;0&amp;lt;/prevLevel&amp;gt;
&amp;lt;probe&amp;gt;processes&amp;lt;/probe&amp;gt;
&amp;lt;robot&amp;gt;server&amp;lt;/robot&amp;gt;
&amp;lt;severity&amp;gt;Warning&amp;lt;/severity&amp;gt;
&amp;lt;source&amp;gt;111.111.111.1111&amp;lt;/source&amp;gt;
&amp;lt;subsystem&amp;gt;Process&amp;lt;/subsystem&amp;gt;
&amp;lt;subsystemId&amp;gt;1.1.2&amp;lt;/subsystemId&amp;gt;
&amp;lt;suppressionCount&amp;gt;0&amp;lt;/suppressionCount&amp;gt;
&amp;lt;suppressionKey&amp;gt;process/ssss.exe [1]/process_state&amp;lt;/suppressionKey&amp;gt;
&amp;lt;timeArrival&amp;gt;2015-06-10T03:59:15-04:00&amp;lt;/timeArrival&amp;gt;
&amp;lt;timeOrigin&amp;gt;2015-06-10T03:59:04-04:00&amp;lt;/timeOrigin&amp;gt;
&amp;lt;timeReceived&amp;gt;2015-06-10T03:59:15-04:00&amp;lt;/timeReceived&amp;gt;
&amp;lt;userTag1&amp;gt;customer&amp;lt;/userTag1&amp;gt;
&amp;lt;userTag2&amp;gt;Production&amp;lt;/userTag2&amp;gt;
&amp;lt;visible&amp;gt;true&amp;lt;/visible&amp;gt;
&amp;lt;/alarm&amp;gt;
&amp;lt;alarm&amp;gt;
&amp;lt;assignedBy/&amp;gt;
&amp;lt;assignedTo/&amp;gt;
&amp;lt;custom1/&amp;gt;
&amp;lt;custom2/&amp;gt;
&amp;lt;custom3/&amp;gt;
&amp;lt;custom4/&amp;gt;
&amp;lt;custom5/&amp;gt;
&amp;lt;devId&amp;gt;D1D431F7A35BB0912BB52FDF175FD3307&amp;lt;/devId&amp;gt;
&amp;lt;domain&amp;gt;org/domain&amp;gt;
&amp;lt;hostname&amp;gt;serverName&amp;lt;/hostname&amp;gt;
&amp;lt;hub&amp;gt;ServerHub&amp;lt;/hub&amp;gt;
&amp;lt;id&amp;gt;YN44419525-32263&amp;lt;/id&amp;gt;
&amp;lt;level&amp;gt;4&amp;lt;/level&amp;gt;
&amp;lt;message&amp;gt;TrackerSvr PMQ: 219 files, expected &amp;lt; 50&amp;lt;/message&amp;gt;
&amp;lt;metId&amp;gt;MF580138FE25DA78DF96521183CA3245A&amp;lt;/metId&amp;gt;
&amp;lt;nas&amp;gt;IND1109C2NM13_NMS&amp;lt;/nas&amp;gt;
&amp;lt;origin&amp;gt;mel063gnh021&amp;lt;/origin&amp;gt;
&amp;lt;prevLevel&amp;gt;0&amp;lt;/prevLevel&amp;gt;
&amp;lt;probe&amp;gt;dirscan&amp;lt;/probe&amp;gt;
&amp;lt;robot&amp;gt;serverName&amp;lt;/robot&amp;gt;
&amp;lt;severity&amp;gt;Major&amp;lt;/severity&amp;gt;
&amp;lt;source&amp;gt;22.22.22.22&amp;lt;/source&amp;gt;
&amp;lt;subsystem&amp;gt;Probe&amp;lt;/subsystem&amp;gt;
&amp;lt;subsystemId&amp;gt;1.2.3&amp;lt;/subsystemId&amp;gt;
&amp;lt;suppressionCount&amp;gt;1431&amp;lt;/suppressionCount&amp;gt;
&amp;lt;suppressionKey&amp;gt;dirscan/TrackerSvr PMQ/number_of_files&amp;lt;/suppressionKey&amp;gt;
&amp;lt;timeArrival&amp;gt;2015-06-08T05:13:29-04:00&amp;lt;/timeArrival&amp;gt;
&amp;lt;timeOrigin&amp;gt;2015-02-09T12:05:17-05:00&amp;lt;/timeOrigin&amp;gt;
&amp;lt;timeReceived&amp;gt;2015-06-08T05:13:29-04:00&amp;lt;/timeReceived&amp;gt;
&amp;lt;userTag1&amp;gt;Customer Name&amp;lt;/userTag1&amp;gt;
&amp;lt;userTag2&amp;gt;Production&amp;lt;/userTag2&amp;gt;
&amp;lt;visible&amp;gt;false&amp;lt;/visible&amp;gt;
&amp;lt;/alarm&amp;gt;
&amp;lt;alarm-list&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jun 2015 02:27:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153315#M13854</guid>
      <dc:creator>ncrisler</dc:creator>
      <dc:date>2015-06-11T02:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153316#M13855</link>
      <description>&lt;P&gt;Try something like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class AlarmHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
        if response_type == "xml": 
            import xml.etree.ElementTree as ET
            alarm_list = ET.fromstring(encodeXMLText(raw_response_output))
            for alarm in alarm_list:
                alarm_xml_str = ET.tostring(alarm, encoding='utf8', method='xml')
                print_xml_stream(alarm_xml_str)               

        else:
            print_xml_stream(raw_response_output) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/386i9C774D58BC26B077/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 03:10:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153316#M13855</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-06-11T03:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153317#M13856</link>
      <description>&lt;P&gt;Should I just be adding this to the bottom of &lt;STRONG&gt;responsehandlers.py&lt;/STRONG&gt; ?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 03:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153317#M13856</guid>
      <dc:creator>ncrisler</dc:creator>
      <dc:date>2015-06-11T03:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153318#M13857</link>
      <description>&lt;P&gt;Yes.you will also see other examples in that file.note , I just gave an example only, may or may not need a little tweaking.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 03:34:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153318#M13857</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-06-11T03:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153319#M13858</link>
      <description>&lt;P&gt;Ok just checking. I am trying it now.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 03:36:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153319#M13858</guid>
      <dc:creator>ncrisler</dc:creator>
      <dc:date>2015-06-11T03:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153320#M13859</link>
      <description>&lt;P&gt;For some reason when I added AlarmHandler to the bottom of responsehandlers it broke the polling of the REST data. Do I need to add import xml to the top of the config?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 18:15:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153320#M13859</guid>
      <dc:creator>ncrisler</dc:creator>
      <dc:date>2015-07-01T18:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153321#M13860</link>
      <description>&lt;P&gt;Shouldn't have to as it imported when the class is called on line 8.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2015 18:45:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153321#M13860</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2015-07-01T18:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: How is linebreaking of events configured when receiving XML logs via REST input?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153322#M13861</link>
      <description>&lt;P&gt;Does this look right?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#add your custom response handler class to this module
import json
import datetime



#the default handler , does nothing , just passes the raw output directly to STDOUT
class DefaultResponseHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
        cookies = response_object.cookies
        if cookies:
            req_args["cookies"] = cookies        
        print_xml_stream(raw_response_output)

#template
class MyResponseHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):        
        print_xml_stream("foobar")

'''various example handlers follow'''

class BoxEventHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
        if response_type == "json":        
            output = json.loads(raw_response_output)
            if not "params" in req_args:
                req_args["params"] = {}
            if "next_stream_position" in output:    
                req_args["params"]["stream_position"] = output["next_stream_position"]
            for entry in output["entries"]:
                print_xml_stream(json.dumps(entry))   
        else:
            print_xml_stream(raw_response_output)  

class QualysGuardActivityLog:
    '''Response handler for QualysGuard activity log.'''

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
        if not "params" in req_args:
            req_args["params"] = {}
        date_from = (datetime.datetime.now() - datetime.timedelta(minutes=1)).strftime("%Y-%m-%dT%H:%M:%SZ")
        req_args["params"]["date_from"] = date_from
        print_xml_stream(raw_response_output) 

class FourSquareCheckinsEventHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
        if response_type == "json":        
            output = json.loads(raw_response_output)
            last_created_at = 0
            for checkin in output["response"]["checkins"]["items"]:
                print_xml_stream(json.dumps(checkin)) 
                if "createdAt" in checkin:
                    created_at = checkin["createdAt"]
                    if created_at &amp;gt; last_created_at:
                        last_created_at = created_at
            if not "params" in req_args:
                req_args["params"] = {}

            req_args["params"]["afterTimestamp"] = last_created_at

        else:
            print_xml_stream(raw_response_output) 

class ThingWorxTagHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
        if response_type == "json":        
            output = json.loads(raw_response_output)
            for row in output["rows"]:
                print_xml_stream(json.dumps(row))                      
        else:
            print_xml_stream(raw_response_output) 

class FireEyeEventHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
        if response_type == "json":        
            output = json.loads(response_object.content)
            last_display_id = -1
            for alert in output["alerts"]:
                print_xml_stream(json.dumps(alert))  
                if "displayId" in alert:
                    display_id = alert["displayId"]
                    if display_id &amp;gt; last_display_id:
                        last_display_id = display_id
            if not "params" in req_args:
                req_args["params"] = {}

            if last_display_id &amp;gt; -1:
                req_args["params"]["offset"] = last_display_id

        else:
            print_xml_stream(raw_response_output) 


class BugsenseErrorsEventHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
        if response_type == "json":        
            output = json.loads(raw_response_output)

            for error in output["data"]:
                print_xml_stream(json.dumps(error))   
        else:
            print_xml_stream(raw_response_output)

class MyCustomHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):

        req_args["data"] = 'What does the fox say'   

        print_xml_stream(raw_response_output)


class TwitterEventHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):       

        if response_type == "json":        
            output = json.loads(raw_response_output)
            last_tweet_indexed_id = 0
            for twitter_event in output["statuses"]:
                print_xml_stream(json.dumps(twitter_event))
                if "id_str" in twitter_event:
                    tweet_id = twitter_event["id_str"]
                    if tweet_id &amp;gt; last_tweet_indexed_id:
                        last_tweet_indexed_id = tweet_id

            if not "params" in req_args:
                req_args["params"] = {}

            req_args["params"]["since_id"] = last_tweet_indexed_id

        else:
            print_xml_stream(raw_response_output)

class JSONArrayHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
        if response_type == "json":
            output = json.loads(raw_response_output)

            for entry in output:
                print_xml_stream(json.dumps(entry))
        else:
            print_xml_stream(raw_response_output)


#HELPER FUNCTIONS

# prints XML stream
def print_xml_stream(s):
    print "&amp;lt;stream&amp;gt;&amp;lt;event unbroken=\"1\"&amp;gt;&amp;lt;data&amp;gt;%s&amp;lt;/data&amp;gt;&amp;lt;done/&amp;gt;&amp;lt;/event&amp;gt;&amp;lt;/stream&amp;gt;" % encodeXMLText(s)



def encodeXMLText(text):
    text = text.replace("&amp;amp;", "&amp;amp;amp;")
    text = text.replace("\"", "&amp;amp;quot;")
    text = text.replace("'", "&amp;amp;apos;")
    text = text.replace("&amp;lt;", "&amp;amp;lt;")
    text = text.replace("&amp;gt;", "&amp;amp;gt;")
    text = text.replace("\n", "")
    return text

class AlarmHandler:

     def __init__(self,**args):
         pass

     def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):
         if response_type == "xml": 
             import xml.etree.ElementTree as ET
             alarm_list = ET.fromstring(encodeXMLText(raw_response_output))
             for alarm in alarm_list:
                 alarm_xml_str = ET.tostring(alarm, encoding='utf8', method='xml')
                 print_xml_stream(alarm_xml_str)               

         else:
             print_xml_stream(raw_response_output) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Jul 2015 19:22:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-is-linebreaking-of-events-configured-when-receiving-XML-logs/m-p/153322#M13861</guid>
      <dc:creator>ncrisler</dc:creator>
      <dc:date>2015-07-01T19:22:20Z</dc:date>
    </item>
  </channel>
</rss>

