<?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 properly extract fields using regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-properly-extract-fields-using-regex/m-p/73567#M18444</link>
    <description>&lt;P&gt;Given that your initial field is called celldata and contains :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cells : "&amp;lt; aN20%title=1| basic%ipin=7| basic%opin=1&amp;gt; "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will split out the data into individual events you can massage with stats :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex max_match=100 field=celldata "(?&amp;lt;key&amp;gt;[\S]+=\d+)" 
| table _time key &amp;lt;other interesting fields here&amp;gt; 
| mvexpand key
| rex field=key "(?&amp;lt;key&amp;gt;[^=]+)=(?&amp;lt;val&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;optionally :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats sum(val) by key
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 25 Mar 2013 17:52:19 GMT</pubDate>
    <dc:creator>jonuwz</dc:creator>
    <dc:date>2013-03-25T17:52:19Z</dc:date>
    <item>
      <title>How to properly extract fields using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-properly-extract-fields-using-regex/m-p/73566#M18443</link>
      <description>&lt;P&gt;I have a following field in my data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cells : "&amp;lt; aN20%title=1| basic%ipin=7| basic%opin=1&amp;gt; "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This means that I have 3 types of cells in this particular event (cell names are dynamic).&lt;BR /&gt;
How can I split this up so that it is like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cells : "aN20%title", cells : "basic%ipin", cells : "basic%opin"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so that a command such as &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;stats count by cells
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;will produce the following list (can be used to populate dropdowns):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;aN20%title
basic%ipin
basic%opin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also would like to filter my cells, for example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cells="aN20%title" OR cells="basic%ipin"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would return all events that have either aN20%title or basic%ipin showing up in the cells field&lt;/P&gt;

&lt;P&gt;The "=X" ("=1" in "aN20%title=1") is the number of instances that this type of cell appears.&lt;BR /&gt;
I would need to be able to add this column with stats sum by cells command.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;P&gt;if I had 2 events&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cells : "&amp;lt; aN20%title=1| basic%ipin=7| basic%opin=1&amp;gt; "
cells : "&amp;lt; aN20%title=2| basic%ipin=2&amp;gt; "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and I wanted to see the sum of the cells, I would receive&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;aN20%title : 3
basic%ipin : 9
basic%opin : 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thus, what is the best way to split this "cells" field up so that I can perform such commands.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 17:06:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-properly-extract-fields-using-regex/m-p/73566#M18443</guid>
      <dc:creator>cmak</dc:creator>
      <dc:date>2013-03-25T17:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly extract fields using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-properly-extract-fields-using-regex/m-p/73567#M18444</link>
      <description>&lt;P&gt;Given that your initial field is called celldata and contains :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cells : "&amp;lt; aN20%title=1| basic%ipin=7| basic%opin=1&amp;gt; "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will split out the data into individual events you can massage with stats :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex max_match=100 field=celldata "(?&amp;lt;key&amp;gt;[\S]+=\d+)" 
| table _time key &amp;lt;other interesting fields here&amp;gt; 
| mvexpand key
| rex field=key "(?&amp;lt;key&amp;gt;[^=]+)=(?&amp;lt;val&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;optionally :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats sum(val) by key
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Mar 2013 17:52:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-properly-extract-fields-using-regex/m-p/73567#M18444</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2013-03-25T17:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly extract fields using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-properly-extract-fields-using-regex/m-p/73568#M18445</link>
      <description>&lt;P&gt;This is amazing, thanks :).&lt;BR /&gt;
Just to let anyone who reads this know, &lt;BR /&gt;
it should be field=cells instead of celldata (just to eliminate any confusion)&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2013 18:02:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-properly-extract-fields-using-regex/m-p/73568#M18445</guid>
      <dc:creator>cmak</dc:creator>
      <dc:date>2013-03-25T18:02:35Z</dc:date>
    </item>
  </channel>
</rss>

