<?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: Re-labeling and breaking up xml stream? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Re-labeling-and-breaking-up-xml-stream/m-p/617900#M106648</link>
    <description>&lt;P&gt;SEDCMD is event-oriented rather than line-oriented.&amp;nbsp; That you see it changing each line implies one line is one event.&amp;nbsp; Either the line breaking settings should be changed or another means found to change the data, such as INGEST_EVAL&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2022 18:24:04 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2022-10-20T18:24:04Z</dc:date>
    <item>
      <title>Re-labeling and breaking up xml stream?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Re-labeling-and-breaking-up-xml-stream/m-p/617725#M106638</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a tcp stream incoming with xml Call Data Records (CDR).&amp;nbsp; enclosed at the end is an example.&lt;/P&gt;&lt;P&gt;The CDR contains information about the caller and destination phone.&amp;nbsp; There are several SEDCMDs in the props.conf to take lines like &lt;EM&gt;&amp;lt;party type="orig"...&lt;/EM&gt; and convert them into&amp;nbsp;&lt;EM&gt;&amp;lt;orig_party...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The problem is with lines whose only differentiation is their position in the data structure.&amp;nbsp; With the xml lines that start with "&amp;lt;RTCPstats&amp;gt;&amp;nbsp; I need to modify their fields:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;I need the first line to be ingested as "&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;lt;orig_PS&amp;gt;31367&amp;lt;/orig_PS&amp;gt; &amp;lt;orig_OS&amp;gt;6273400&amp;lt;/orig_OS&amp;gt;...&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;" and the second line as "&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;lt;term_PS&amp;gt;31366&amp;lt;/term_PS&amp;gt;, &amp;lt;term_OS&amp;gt;6273200&amp;lt;/term_OS&amp;gt;...&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;".&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;flowinfo&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;RTCPstats&amp;gt;PS=31367, OS=6273400,..&amp;gt;&amp;nbsp; &amp;nbsp;&amp;lt;/flowinfo&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;flowinfo&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;RTCPstats&amp;gt;PS=31366, OS=6273200,...&amp;gt;&amp;nbsp; &amp;nbsp; &amp;lt;/flowinfo&amp;gt;&lt;/PRE&gt;&lt;P&gt;The actual sed command "sed -r -e&amp;nbsp;'0,/ ?([A-Z_]*)=([0-9]*)/s//&amp;lt;ORIG_\1&amp;gt;\2&amp;lt;\/ORIG_\1&amp;gt;/g'" will do this, but the same entry in the SEDCMD will not.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Altering a line of input is easy: altering only the FIRST instance in a record with embedded newlines is not.&lt;/P&gt;&lt;P&gt;What are my options?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;SEDCMD&amp;nbsp; in props.conf?&lt;UL&gt;&lt;LI&gt;strip out all newlines so sedcmd treats it all as one? (can't really do it w. sed...)&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;regex in transforms.conf?&lt;/LI&gt;&lt;LI&gt;pass input through a script that CAN do this?&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Some details:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The linebreaker is two carriage returns (literally \r\r, or 0d0d).&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;There are embedded newlines in each record so any SEDCMD will be applied to each line, not the entire record all at once.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I get 60,000 records per minute: this transformation needs to be fast.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;Sample record: (spaced out neatly)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;e&amp;gt;
  &amp;lt;st&amp;gt;Perimeta XML CDR&amp;lt;/st&amp;gt;
  &amp;lt;h&amp;gt;the perimeta hostname&amp;lt;/h&amp;gt;
  &amp;lt;t&amp;gt;1664838107186&amp;lt;/t&amp;gt;
  &amp;lt;tid&amp;gt;2814754955435820&amp;lt;/tid&amp;gt;
  &amp;lt;sid&amp;gt;2082&amp;lt;/sid&amp;gt;
  &amp;lt;eid&amp;gt;CDR&amp;lt;/eid&amp;gt;
  &amp;lt;call starttime="1664837476918" starttime_local="2022-10-03T15:51:16-0700" endtime="1664838107179" endtime_local="2022-10-03T16:01:47-0700" duration="630261" release_side="term" bcid="a big string of numbers and letters"&amp;gt;
    &amp;lt;party type="orig" phone="caller phonenumber" domain="ipaddr1" sig_address="ipaddr1" sig_port="5060" sig_transport="udp" trunk_group="trunkgroupname" trunk_context="nap" sip_call_id="anumber@adestination"/&amp;gt;
    &amp;lt;party type="term" phone="destination phonenumber" domain="0.0.0.0" routing_number="a routing number" sig_address="&amp;lt;an ip addr&amp;gt;" sig_port="5060" sig_transport="udp" trunk_group="6444" trunk_context="itg" edit_trunk_group="" edit_trunk_context="" sip_call_id="adifferentnumber@adifferentdestination"/&amp;gt;
    &amp;lt;adjacency type="orig" name="orig_adjacency_system" account="" vpnid="0X00000001" mediarealm="CoreMedia1"/&amp;gt;
    &amp;lt;adjacency type="term" name="dest_adjacency_system" account="" vpnid="0X00000004" mediarealm="CoreMedia1"/&amp;gt;
    &amp;lt;category name="cat.sbc.redirected"/&amp;gt;
    &amp;lt;connect time="1664837483144" time_local="2022-10-03T15:51:23-0700"/&amp;gt;
    &amp;lt;firstendrequest time="1664838107158" time_local="2022-10-03T16:01:47-0700"/&amp;gt;
    &amp;lt;disconnect time="1664838107179" time_local="2022-10-03T16:01:47-0700" reason="0"/&amp;gt;
    &amp;lt;redirector bcid="another string of letters and numbers" editphone="a phone number"/&amp;gt;
    &amp;lt;post_dial_delay duration="2895"/&amp;gt;
    &amp;lt;QoS stream_id="1" instance="0" reservetime="1664837476918" reservetime_local="2022-10-03T15:51:16-0700" committime="1664837483144" committime_local="2022-10-03T15:51:23-0700" releasetime="1664838107184" releasetime_local="2022-10-03T16:01:47-0700"&amp;gt;
      &amp;lt;gate&amp;gt;
        &amp;lt;flowinfo&amp;gt;
          &amp;lt;local address="an ip address" port="63130"/&amp;gt;
          &amp;lt;remote address="another ip address" port="36214"/&amp;gt;
          &amp;lt;sd&amp;gt;m=audio 0 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=ptime:20
&amp;lt;/sd&amp;gt;
          &amp;lt;RTCPstats&amp;gt;PS=31367, OS=6273400, PR=31366, OR=6273200, PD=0, OD=0, PL=0, JI=0, TOS=0, TOR=0, LA=0, PC/RPS=31165, PC/ROS=4986400, PC/RPR=31367, PC/RPL=0, PC/RJI=0, PC/RLA=0, RF=91, MOS=43, PC/RAJ=0, PC/RML=0&amp;lt;/RTCPstats&amp;gt;
        &amp;lt;/flowinfo&amp;gt;
        &amp;lt;flowinfo&amp;gt;
          &amp;lt;local address="an ip address" port="19648"/&amp;gt;
          &amp;lt;remote address="a diffrent ip address" port="26046"/&amp;gt;
          &amp;lt;sd&amp;gt;m=audio 0 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=ptime:20
&amp;lt;/sd&amp;gt;
          &amp;lt;RTCPstats&amp;gt;PS=31366, OS=6273200, PR=31367, OR=6273400, PD=0, OD=0, PL=0, JI=0, TOS=0, TOR=0, LA=0, PC/RPS=0, PC/ROS=0, PC/RPR=0, PC/RPL=0, PC/RJI=0, PC/RLA=0, RF=82, MOS=41, PC/RAJ=0, PC/RML=0&amp;lt;/RTCPstats&amp;gt;
        &amp;lt;/flowinfo&amp;gt;
      &amp;lt;/gate&amp;gt;
    &amp;lt;/QoS&amp;gt;
  &amp;lt;/call&amp;gt;
&amp;lt;/e&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 22:53:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Re-labeling-and-breaking-up-xml-stream/m-p/617725#M106638</guid>
      <dc:creator>jason0</dc:creator>
      <dc:date>2022-10-19T22:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Re-labeling and breaking up xml stream?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Re-labeling-and-breaking-up-xml-stream/m-p/617849#M106644</link>
      <description>&lt;P&gt;To change only the first match, remove the 'g' flag from the end of the sed command.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 14:07:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Re-labeling-and-breaking-up-xml-stream/m-p/617849#M106644</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-10-20T14:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Re-labeling and breaking up xml stream?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Re-labeling-and-breaking-up-xml-stream/m-p/617878#M106647</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried that, but the problem is that the sedcmd is still line oriented on newlines: thus the second line appears to be a separate record and still gets changed.&lt;/P&gt;&lt;P&gt;--jason&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 15:24:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Re-labeling-and-breaking-up-xml-stream/m-p/617878#M106647</guid>
      <dc:creator>jason0</dc:creator>
      <dc:date>2022-10-20T15:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Re-labeling and breaking up xml stream?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Re-labeling-and-breaking-up-xml-stream/m-p/617900#M106648</link>
      <description>&lt;P&gt;SEDCMD is event-oriented rather than line-oriented.&amp;nbsp; That you see it changing each line implies one line is one event.&amp;nbsp; Either the line breaking settings should be changed or another means found to change the data, such as INGEST_EVAL&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2022 18:24:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Re-labeling-and-breaking-up-xml-stream/m-p/617900#M106648</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-10-20T18:24:04Z</dc:date>
    </item>
  </channel>
</rss>

