<?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: Regex help: Colon space  and comma as key-value pair in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315150#M94356</link>
    <description>&lt;P&gt;Looking at the transforms.conf documentation, it should be just &lt;CODE&gt;FORMAT=$1::$2&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2018 09:38:40 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2018-02-28T09:38:40Z</dc:date>
    <item>
      <title>Regex help: Colon space  and comma as key-value pair</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315147#M94353</link>
      <description>&lt;P&gt;I'm trying to figure out better way of doing regex for a data like below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Protocol: TCP, SrcIP: 1.2.3.4, OriginalClientIP: ::, DstIP: 5.6.7.8, SrcPort: 1234, DstPort: 678, TCPFlags: 0x0, DE: some engine (6xxxxxe-a010-11e7-b61b-xxxxxxx), Policy: my-home-policy, ConnectType: End, AccessControlRuleName: AB-CD-EFG, AccessControlRuleAction: Allow, Prefilter Policy: AB-CD-EFG, UserName: User A, InitiatorPackets: 4, ResponderPackets: 2, InitiatorBytes: 288, ResponderBytes: 148, NAPPolicy: AB-CD-EFG-Analysis-Policy, DNSResponseType: No Error, Sinkhole: Unknown, URLCategory: Unknown, URLReputation: Highly Risky
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was looking to split this into key-value pairs, so it becomes&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Protocol=TCP
OriginalClientIP="" 
UserName="User A"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the key-value split is &lt;CODE&gt;:\s&lt;/CODE&gt;   and &lt;CODE&gt;.*&lt;/CODE&gt; until it finds a &lt;CODE&gt;comma&lt;/CODE&gt;. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;key&amp;gt;\w+):\s+(?&amp;lt;value&amp;gt;.*?)(\,|$)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Above regex works in regex101, but not in transforms.conf . Or put in more precisely, the &lt;CODE&gt;value&lt;/CODE&gt; is not getting assigned to the &lt;CODE&gt;key&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 08:58:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315147#M94353</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2018-02-28T08:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help: Colon space  and comma as key-value pair</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315148#M94354</link>
      <description>&lt;P&gt;What exactly does your transforms.conf look like?&lt;/P&gt;

&lt;P&gt;Should be something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[&amp;lt;stanzaname here&amp;gt;]
REGEX = (\w+):\s+([^,]*)(?:,|$)
FORMAT = $1::$2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And why not simply use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DELIMS = ",", ":"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Feb 2018 09:11:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315148#M94354</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-28T09:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help: Colon space  and comma as key-value pair</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315149#M94355</link>
      <description>&lt;P&gt;thanks for your &lt;CODE&gt;DELIMS&lt;/CODE&gt; suggestion. I will try that out &lt;/P&gt;

&lt;P&gt;(The transforms looks like what you mentiond. I have seen in other posts that we might need to put double quotes over FORMAT.   so something like   &lt;CODE&gt;FORMAT = "$1": $2&lt;/CODE&gt;   .  I will try both of them anyway.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 09:28:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315149#M94355</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2018-02-28T09:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help: Colon space  and comma as key-value pair</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315150#M94356</link>
      <description>&lt;P&gt;Looking at the transforms.conf documentation, it should be just &lt;CODE&gt;FORMAT=$1::$2&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 09:38:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315150#M94356</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-28T09:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help: Colon space  and comma as key-value pair</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315151#M94357</link>
      <description>&lt;P&gt;DELIMS did the trick. thanks for the idea&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 10:22:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-Colon-space-and-comma-as-key-value-pair/m-p/315151#M94357</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2018-03-02T10:22:21Z</dc:date>
    </item>
  </channel>
</rss>

