<?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 work around SEDCMD trumping EXTRACT and TRANSFORM in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-work-around-SEDCMD-trumping-EXTRACT-and-TRANSFORM/m-p/455319#M78771</link>
    <description>&lt;P&gt;The SEDCMD is executed during parsing time (before indexing), so it should be deployed to your Heavy forwarder OR indexer whichever comes first. The EXTRACT is a search time field extraction, so it executes (obviously after indexing is done) during a search is fired on that sourcetype. &lt;/P&gt;

&lt;P&gt;For your use-case try something like this (props.conf on your heavy forwarder OR indexer)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[cbms_merchant_logs]
SEDCMD-transaction_id_ext = s/^(\w{23})(\|.+)/transactionId="\1"\2/
SEDCMD-strip-transaction-id = s/\w{23})\|//g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 May 2019 21:21:03 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-05-14T21:21:03Z</dc:date>
    <item>
      <title>How to work around SEDCMD trumping EXTRACT and TRANSFORM</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-work-around-SEDCMD-trumping-EXTRACT-and-TRANSFORM/m-p/455318#M78770</link>
      <description>&lt;P&gt;I have events that look like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1pjxVfF7i84nvqrD4p24UVa|2019-05-14 20:41:04.035:[0:T][T1847][PaymentMethodLogoRepositoryImpl][1300][]Fetch logo (consulate_0704c4eb6fb5)
1pjxVfF7i84nvqrD4p24UVa|    paymentMethod=Interac
1pjxVfF7i84nvqrD4p24UVa|    countryCode=CA
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note the repetition of &lt;CODE&gt;1pjxVfF7i84nvqrD4p24UVa|&lt;/CODE&gt; for every line of the log - sometimes the events are hundreds of lines long. The repetition is wasteful noise.&lt;/P&gt;

&lt;P&gt;I want to extract the repeated value into a variable (e.g. &lt;CODE&gt;transaction_id="1pjxVfF7i84nvqrD4p24UVa"&lt;/CODE&gt;. I've used the following for that in props.conf and a SEDCMD to strip the data from _raw&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[cbms_merchant_logs]
EXTRACT-transaction_id = ^(?\w{23})\|\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}:
SEDCMD-strip-transaction-id = s/\w{23})\|//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From what I understand, the SEDCMD executes first so the data won't be available for the EXTRACT.&lt;/P&gt;

&lt;P&gt;How can I achieve the goals of key-value EXTRACTION and SEDCMD substitution? Multiple TRANSFORMS perhaps? Examples are appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 21:04:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-work-around-SEDCMD-trumping-EXTRACT-and-TRANSFORM/m-p/455318#M78770</guid>
      <dc:creator>chrismmckenna</dc:creator>
      <dc:date>2019-05-14T21:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to work around SEDCMD trumping EXTRACT and TRANSFORM</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-work-around-SEDCMD-trumping-EXTRACT-and-TRANSFORM/m-p/455319#M78771</link>
      <description>&lt;P&gt;The SEDCMD is executed during parsing time (before indexing), so it should be deployed to your Heavy forwarder OR indexer whichever comes first. The EXTRACT is a search time field extraction, so it executes (obviously after indexing is done) during a search is fired on that sourcetype. &lt;/P&gt;

&lt;P&gt;For your use-case try something like this (props.conf on your heavy forwarder OR indexer)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[cbms_merchant_logs]
SEDCMD-transaction_id_ext = s/^(\w{23})(\|.+)/transactionId="\1"\2/
SEDCMD-strip-transaction-id = s/\w{23})\|//g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 May 2019 21:21:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-work-around-SEDCMD-trumping-EXTRACT-and-TRANSFORM/m-p/455319#M78771</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-05-14T21:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to work around SEDCMD trumping EXTRACT and TRANSFORM</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-work-around-SEDCMD-trumping-EXTRACT-and-TRANSFORM/m-p/455320#M78772</link>
      <description>&lt;P&gt;I made this an answer because I'm hoping that the lack of response meant you "answered" the question for @chrismmckenna. We'll find out by seeing if he accepts this as an answer.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 12:52:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-work-around-SEDCMD-trumping-EXTRACT-and-TRANSFORM/m-p/455320#M78772</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2019-07-01T12:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to work around SEDCMD trumping EXTRACT and TRANSFORM</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-work-around-SEDCMD-trumping-EXTRACT-and-TRANSFORM/m-p/455321#M78773</link>
      <description>&lt;P&gt;That's what I would suggest as well. Keep the value on the first line of the event and remove it elsewhere. Note: with the naming you have now, wouldn't the second one be executed first (because s comes before t)?&lt;/P&gt;

&lt;P&gt;An alternative could be is to write a SED that only triggers for the subsequent lines (where the &lt;CODE&gt;|&lt;/CODE&gt; is followed by some white space: &lt;CODE&gt;SEDCMD-strip-transaction-id = s/\w{23})\|\s+//g&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 14:51:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-work-around-SEDCMD-trumping-EXTRACT-and-TRANSFORM/m-p/455321#M78773</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-07-01T14:51:21Z</dc:date>
    </item>
  </channel>
</rss>

