<?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: Need Regex help in parsing specific fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212764#M62357</link>
    <description>&lt;P&gt;Have you tried using the field extractor?&lt;/P&gt;

&lt;H1&gt;it builds the regex for you&lt;/H1&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.3/Scenarios/Extractfields"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.3/Scenarios/Extractfields&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;parterID and the the other fields that are obvious a=b key-value pairs should be detected automatically in smart / verbose mode.&lt;/P&gt;

&lt;P&gt;If not, I will help you anyway because regex is love, regex is life&lt;/P&gt;

&lt;H4&gt;&lt;A href="https://regex101.com/r/cO8sB0/1"&gt;https://regex101.com/r/cO8sB0/1&lt;/A&gt;&lt;/H4&gt;

&lt;PRE&gt;&lt;CODE&gt;partnerID=(?&amp;lt;partnerID&amp;gt;\d+).*offerIds=(?&amp;lt;offerIds&amp;gt;[^,]+).*redemptionDate=(?&amp;lt;redemptionDate&amp;gt;[^,]+).*productBarCode":"(?&amp;lt;productBarCode&amp;gt;[^"]+).*productCost":(?&amp;lt;productCost&amp;gt;[^,]+).*partnerId":"(?&amp;lt;parnterID&amp;gt;[^"]+).*RedemptionDate":"(?&amp;lt;RedemptionDate&amp;gt;[^"]+).*TransactionId":"(?&amp;lt;TransactionId&amp;gt;[^"]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 24 Sep 2016 19:58:56 GMT</pubDate>
    <dc:creator>aljohnson_splun</dc:creator>
    <dc:date>2016-09-24T19:58:56Z</dc:date>
    <item>
      <title>Need Regex help in parsing specific fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212762#M62355</link>
      <description>&lt;P&gt;String is -----------------&lt;BR /&gt;
OfferRedeemedRequest [&lt;STRONG&gt;partnerID&lt;/STRONG&gt;=1234, partnerName=MCenter, messagePriority=9, userID=2a28bc-119d7597, channel=rest, &lt;STRONG&gt;offerIds&lt;/STRONG&gt;=1bf6-16a0fdd59fc4, &lt;STRONG&gt;redemptionDate&lt;/STRONG&gt;=2016-05-14T11:56:24+0000, &lt;STRONG&gt;productBarCode&lt;/STRONG&gt;=null, productBarCodeType=null, productQuantity=null, productCost=null, productDiscount=null, transactionID=null, posID=null, storeID=null, storeName=null, correlationID=null, JmsHeaderPriority=4, JMSPriority=4, destination=PARTNER_REDEMPTION_CONNECTOR_SENDER_QUEUE, bannerOmsPid=151, bodyPayload={"offerRedemptionProductDetails":[{"&lt;STRONG&gt;productBarCode&lt;/STRONG&gt;":"342423409351","productBarCodeType":"gtin","productQuantity":1,"&lt;STRONG&gt;productCost&lt;/STRONG&gt;":3.99,"actualDiscount":"-5.0"}],"&lt;STRONG&gt;offerIds&lt;/STRONG&gt;":"1bf8b493-e6a0fdd59fc4","timeZoneOffset":0,"appId":"30cbd0ce-9ae4-44dc-a783-1f391942874d","bannerOmsPid":18651,"eventType":"OfferRedeemed","&lt;STRONG&gt;partnerId&lt;/STRONG&gt;":"14p59-11e2-8b8b-0800200c9p69","userId":"2a2b88e0-e8bc-0050569d7597","priority":9,"channel":"rest","details":{"offerIdType":"offerId","location":"","OfferGs1":"8110003025902520535001101503161231","Void":"No","ProductQty":"0","activationDate":"2016-03-13T01:37:42+0000","OfferState":"Redeemed","OfferCode":"193218370","deviceId":"","correlationId":"4090914257","HttpUserAgent":"Jakarta Commons-HttpClient/3.0.1","ProductPrice":"0.0","&lt;STRONG&gt;RedemptionDate&lt;/STRONG&gt;":"2016-03-14T11:56:24+0000","&lt;STRONG&gt;TransactionId&lt;/STRONG&gt;":"11297895292","ActivationId":"2db41330-e8bc-11e5-b2eb-005056b94bc4","channel":"ECOMM"},"timestamp":"Mar 14, 2016 4:58:24 AM","partnerName":"MCenter"}]&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;From the above I just wanted to iterate through to create a table with just the BOLDED fields like&lt;/P&gt;

&lt;P&gt;partnerID|offerIds|redemptionDate|-------&lt;/P&gt;

&lt;P&gt;in below examples, there is multiple offerId in a request and wanted to table in the same column. Any help would be appreciated.&lt;/P&gt;

&lt;P&gt;Tried OfferRedeemedRequest [partnerID=(?[^']+), but I get the entire request.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:09:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212762#M62355</guid>
      <dc:creator>arunsubram</dc:creator>
      <dc:date>2020-09-29T11:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need Regex help in parsing specific fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212763#M62356</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | extract mv_add=t pairdelim="," kvdelim="=:" | table &amp;lt;&amp;lt;BOLDED FIELDS&amp;gt;&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Extract"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Extract&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Sep 2016 19:57:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212763#M62356</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-24T19:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need Regex help in parsing specific fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212764#M62357</link>
      <description>&lt;P&gt;Have you tried using the field extractor?&lt;/P&gt;

&lt;H1&gt;it builds the regex for you&lt;/H1&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.3/Scenarios/Extractfields"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.3/Scenarios/Extractfields&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;parterID and the the other fields that are obvious a=b key-value pairs should be detected automatically in smart / verbose mode.&lt;/P&gt;

&lt;P&gt;If not, I will help you anyway because regex is love, regex is life&lt;/P&gt;

&lt;H4&gt;&lt;A href="https://regex101.com/r/cO8sB0/1"&gt;https://regex101.com/r/cO8sB0/1&lt;/A&gt;&lt;/H4&gt;

&lt;PRE&gt;&lt;CODE&gt;partnerID=(?&amp;lt;partnerID&amp;gt;\d+).*offerIds=(?&amp;lt;offerIds&amp;gt;[^,]+).*redemptionDate=(?&amp;lt;redemptionDate&amp;gt;[^,]+).*productBarCode":"(?&amp;lt;productBarCode&amp;gt;[^"]+).*productCost":(?&amp;lt;productCost&amp;gt;[^,]+).*partnerId":"(?&amp;lt;parnterID&amp;gt;[^"]+).*RedemptionDate":"(?&amp;lt;RedemptionDate&amp;gt;[^"]+).*TransactionId":"(?&amp;lt;TransactionId&amp;gt;[^"]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Sep 2016 19:58:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212764#M62357</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2016-09-24T19:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need Regex help in parsing specific fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212765#M62358</link>
      <description>&lt;P&gt;Thanks a lot. The field extractor worked perfectly fine.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Sep 2016 07:45:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212765#M62358</guid>
      <dc:creator>arunsubram</dc:creator>
      <dc:date>2016-09-25T07:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need Regex help in parsing specific fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212766#M62359</link>
      <description>&lt;P&gt;Hi, Extract fields did work for me as mentioned  base search | extract mv_add=t pairdelim="," kvdelim="=:" | table &amp;lt;&amp;gt;&lt;BR /&gt;
. However in a single transaction records there is duplicates of the same &amp;lt;&amp;gt; like as you in the above string OfferIds gets repeated, partnerId gets repeated.&lt;BR /&gt;
When I try to dedup offerId, partnerId after extracting and then table, it does not work. Any help would be appreciated to remove the duplicates&lt;/P&gt;

&lt;P&gt;base search | extract mv_add=t pairdelim="," kvdelim="=:" |dedup ActivationId,partnerId,userId,offerIds,activationType,activationDate,channel  | table ActivationId,partnerId,userId,offerIds,activationType,activationDate,channel &lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 22:37:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-Regex-help-in-parsing-specific-fields/m-p/212766#M62359</guid>
      <dc:creator>arunsubram</dc:creator>
      <dc:date>2016-09-26T22:37:05Z</dc:date>
    </item>
  </channel>
</rss>

