<?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 extract fields from key/value, but separated with &amp;quot;|&amp;quot; symbol? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266973#M80298</link>
    <description>&lt;P&gt;OK, then you need to switch from &lt;CODE&gt;pipes&lt;/CODE&gt; to &lt;CODE&gt;commas&lt;/CODE&gt; so use this RegEx instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; REGEX = ([^\s:,]+)\s*:\s*([^:,]*)(?:\s*,|$)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Oct 2015 16:18:38 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-10-08T16:18:38Z</dc:date>
    <item>
      <title>How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266963#M80288</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I have my syslog file writen as the following. I index these events in a syslog sourcetype. &lt;BR /&gt;
What I need to extract are fields as PacketyType, PacketIndex, SkinTemperature, StepCounter, DELTADISTANCE and so on...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SocketTLMD:  --------------------   Client :1| PacketType : 6 | senderID : 1.0.0.5 | PacketIndex :26| BatteryVoltage :189| SkinTemperature :23.76| RSSI :78| StepCounter :1| FallCounter :0| AlmostFallCounter :0| MobilityIndex :42| userID : 132234 | CRC :202  | DISTANCE: -3825233.931520 | DELTADISTANCE: -0.000000 | DELTACOLARIES: -0.000000 | SPEED: -0.000000 | DELTASTEP: 0 --------------
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Could you suggest a rex to extract only one of these fields?&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Skender&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 08:37:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266963#M80288</guid>
      <dc:creator>skender27</dc:creator>
      <dc:date>2015-10-08T08:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266964#M80289</link>
      <description>&lt;P&gt;Hi skender27,&lt;/P&gt;

&lt;P&gt;one hint would be &lt;CODE&gt;extract&lt;/CODE&gt; &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/Extract"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.0/SearchReference/Extract&lt;/A&gt; another hint can be this answer &lt;A href="http://answers.splunk.com/answers/214487/can-i-extract-a-field-with-a-regexed-dynamic-field.html"&gt;http://answers.splunk.com/answers/214487/can-i-extract-a-field-with-a-regexed-dynamic-field.html&lt;/A&gt; .. in your use case you would split the key value pair with the &lt;CODE&gt;|&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 08:45:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266964#M80289</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-10-08T08:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266965#M80290</link>
      <description>&lt;P&gt;Hi MuS, &lt;BR /&gt;
Thanks a lot.&lt;/P&gt;

&lt;P&gt;I'd prefer insert the extraction in &lt;STRONG&gt;props.conf&lt;/STRONG&gt; like (example for the PacketType field):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-pcktype = PacketType :  (?P&amp;lt;pcktype&amp;gt;\d+)\s\|
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that I cannot extratc all the fields I need, changing slightly the precedent regex it seems it is not enough...&lt;/P&gt;

&lt;P&gt;I will try again!&lt;/P&gt;

&lt;P&gt;Thanks anyway,&lt;BR /&gt;
Skender &lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 08:59:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266965#M80290</guid>
      <dc:creator>skender27</dc:creator>
      <dc:date>2015-10-08T08:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266966#M80291</link>
      <description>&lt;P&gt;try this regex &lt;CODE&gt;(\w+)[\s:\-\s]*([^|\s]+)&lt;/CODE&gt; .. thanks for the kudos &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 09:17:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266966#M80291</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-10-08T09:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266967#M80292</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;H3&gt;props.conf:&lt;/H3&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourSourcetypeHere]
REPORT-kvps = colon_pipe_kvps
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H3&gt;transforms.conf&lt;/H3&gt;

&lt;PRE&gt;&lt;CODE&gt;[colon_pipe_kvps]
FORMAT = $1::$2
MV_ADD = 1
REGEX = ([^\s:\|]+)\s*:\s*([^:\|]*)(?:\s*\||$)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Oct 2015 11:38:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266967#M80292</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-08T11:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266968#M80293</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I added the stanzas you suggested in the .conf files, but it is still not working.&lt;BR /&gt;
Splunk in some way recognizes the JSON input format and so I'd prefer to make use of this...&lt;/P&gt;

&lt;P&gt;This is how I see in the events in Splunk:&lt;/P&gt;

&lt;P&gt;&amp;lt;30&amp;gt;Oct  8 12:46:19 SocketTLMD: (27082) JSON input: {"Client":1,"PacketType":"6","senderID":"1.0.0.4","PacketIndex":121,"BatteryVoltage":184,"SkinTemperature":22.48,"RSSI":92,"StepCounter":13,"FallCounter":0,"AlmostFallCounter":0,"MobilityIndex":58,"userID":"020901","CRC":33}&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 12:32:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266968#M80293</guid>
      <dc:creator>skender27</dc:creator>
      <dc:date>2015-10-08T12:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266969#M80294</link>
      <description>&lt;P&gt;There were problems with my RegEx but I fixed and updated my answer.  Try it again.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 13:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266969#M80294</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-08T13:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266970#M80295</link>
      <description>&lt;P&gt;There was also a mismatch in my KO name so copy EVERYTHING fresh.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 13:31:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266970#M80295</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-08T13:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266971#M80296</link>
      <description>&lt;P&gt;After I backed-up my .conf files, actually I am resolving it adding each extraction from the syslog:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-Distance = DISTANCE:\s(?&amp;lt;distance&amp;gt;\d+)
EXTRACT-Calories = Calories:\s(?&amp;lt;calories&amp;gt;\d+)
EXTRACT-PktType = PacketType :\s(?&amp;lt;pcktype&amp;gt;\d+)
EXTRACT-UserID = userID :\s(?&amp;lt;userTLMD&amp;gt;\d+)
EXTRACT-DeltaStep = DELTASTEP:\s(?&amp;lt;deltastep&amp;gt;\d+)\s\-
EXTRACT-DeltaDistance = DELTADISTANCE:\s(?&amp;lt;ddistance&amp;gt;\d+)
EXTRACT-DeltaCalories = DELTACOLARIES:\s(?&amp;lt;dcalories&amp;gt;\d+)
EXTRACT-Speed = SPEED:\s(?&amp;lt;speed&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Oct 2015 16:09:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266971#M80296</guid>
      <dc:creator>skender27</dc:creator>
      <dc:date>2015-10-08T16:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266972#M80297</link>
      <description>&lt;P&gt;Be aware that this is 8x more expensive than my single-pass solution (which I tested and does work, after I re-edited it to remove a couple of mistakes).&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 16:16:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266972#M80297</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-08T16:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266973#M80298</link>
      <description>&lt;P&gt;OK, then you need to switch from &lt;CODE&gt;pipes&lt;/CODE&gt; to &lt;CODE&gt;commas&lt;/CODE&gt; so use this RegEx instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; REGEX = ([^\s:,]+)\s*:\s*([^:,]*)(?:\s*,|$)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Oct 2015 16:18:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266973#M80298</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-08T16:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266974#M80299</link>
      <description>&lt;P&gt;Thanks Woodcock, &lt;/P&gt;

&lt;P&gt;I do not know why it is not working your settings in .conf files.&lt;BR /&gt;
Probably because the events itself are not clean, not exactly as JSON input I put in the example, there are also other info, open and close of an external database, not so ordinary in the log I receive...&lt;/P&gt;

&lt;P&gt;Anyway, thanks again,&lt;BR /&gt;
Skender&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 08:50:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266974#M80299</guid>
      <dc:creator>skender27</dc:creator>
      <dc:date>2015-10-09T08:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract fields from key/value, but separated with "|" symbol?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266975#M80300</link>
      <description>&lt;P&gt;it is better to use this syntax in order to extract integer numbers and not just digits:&lt;BR /&gt;
(for example) &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-Speed = SPEED:\s(?&amp;lt;speed&amp;gt;\d+\.\d+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Oct 2015 16:08:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-fields-from-key-value-but-separated-with-quot/m-p/266975#M80300</guid>
      <dc:creator>skender27</dc:creator>
      <dc:date>2015-10-12T16:08:34Z</dc:date>
    </item>
  </channel>
</rss>

