<?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 and create a field named &amp;quot;type&amp;quot; using regex &amp;quot;(?m)^(?P([A-Za-z])[^,]+)&amp;quot; and multikv in a search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120545#M32403</link>
    <description>&lt;P&gt;Actually I'm looking for all the first words before the comma i.e; AAA CPU_ALL MEM etc&lt;/P&gt;</description>
    <pubDate>Wed, 01 Apr 2015 17:55:24 GMT</pubDate>
    <dc:creator>d29priyanka</dc:creator>
    <dc:date>2015-04-01T17:55:24Z</dc:date>
    <item>
      <title>How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120541#M32399</link>
      <description>&lt;P&gt;I have a splunk search which has multikv and regex.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os OR index=advantage sourcetype="*nmon*" |multikv|rex field=_raw "(?m)^(?P([A-Za-z])[^,]+)"| dedup type|table type| sort type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to create a field in field extractions named &lt;CODE&gt;type&lt;/CODE&gt; for regex "(?m)^(?P([A-Za-z])[^,]+)".&lt;BR /&gt;
Regex seems to work with only multikv. Can anyone help on how to create a field which uses a regex and multikv?&lt;/P&gt;

&lt;P&gt;My single event looks like this:&lt;BR /&gt;
AAA,note0, Warning - use the UNIX sort command to order this file before loading into a spreadsheet&lt;BR /&gt;
AAA,note1, The First Column is simply to get the output sorted in the right order&lt;BR /&gt;
AAA,note2, The T0001-T9999 column is a snapshot number. To work out the actual time; see the ZZZ section at the end&lt;BR /&gt;
CPU_ALL,CPU Total esbqpas11,User%,Sys%,Wait%,Idle%,Busy,PhysicalCPUs &lt;BR /&gt;
PCPU_ALL,PCPU Total esbqpas11,User  ,Sys  ,Wait  ,Idle  , Entitled Capacity &lt;BR /&gt;
SCPU_ALL,SCPU Total esbqpas11,User  ,Sys  ,Wait  ,Idle&lt;BR /&gt;&lt;BR /&gt;
PCPU01,PCPU 1 esbqpas11,User ,Sys ,Wait ,Idle &lt;BR /&gt;
PCPU02,PCPU 2 esbqpas11,User ,Sys ,Wait ,Idle &lt;BR /&gt;
SCPU01,SCPU 1 esbqpas11,User ,Sys ,Wait ,Idle &lt;BR /&gt;
SCPU02,SCPU 2 esbqpas11,User ,Sys ,Wait ,Idle &lt;BR /&gt;
SCPU03,SCPU 3 esbqpas11,User ,Sys ,Wait ,Idle &lt;BR /&gt;
SCPU04,SCPU 4 esbqpas11,User ,Sys ,Wait ,Idle &lt;BR /&gt;
SCPU05,SCPU 5 esbqpas11,User ,Sys ,Wait ,Idle &lt;BR /&gt;
SCPU06,SCPU 6 esbqpas11,User ,Sys ,Wait ,Idle &lt;BR /&gt;
MEM,Memory esbqpas11,Real Free %,Virtual free %,Real free(MB),Virtual free(MB),Real total(MB),Virtual total(MB)&lt;BR /&gt;
MEMNEW,Memory New esbqpas11,Process%,FScache%,System%,Free%,Pinned%,User%&lt;BR /&gt;
MEMUSE,Memory Use esbqpas11,%numperm,%minperm,%maxperm,minfree,maxfree,%numclient,%maxclient, lruable pages&lt;BR /&gt;
PAGE,Paging esbqpas11,faults,pgin,pgout,pgsin,pgsout,reclaims,scans,cycles&lt;BR /&gt;
PROC,Processes esbqpas11,Runnable,Swap-in,pswitch,syscall,read,write,fork,exec,sem,msg,asleep_bufio,asleep_rawio,asleep_diocio&lt;BR /&gt;
FILE,File I/O esbqpas11,iget,namei,dirblk,readch,writech,ttyrawch,ttycanch,ttyoutch&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:22:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120541#M32399</guid>
      <dc:creator>d29priyanka</dc:creator>
      <dc:date>2020-09-28T19:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120542#M32400</link>
      <description>&lt;P&gt;we should ask ppl to post  at least an event. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2015 17:30:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120542#M32400</guid>
      <dc:creator>tonykung</dc:creator>
      <dc:date>2015-04-01T17:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120543#M32401</link>
      <description>&lt;P&gt;My single event looks like this:&lt;/P&gt;

&lt;P&gt;AAA,note0, Warning - use the UNIX sort command to order this file before loading into a spreadsheet&lt;BR /&gt;
AAA,note1, The First Column is simply to get the output sorted in the right order&lt;BR /&gt;
AAA,note2, The T0001-T9999 column is a snapshot number. To work out the actual time; see the ZZZ section at the end&lt;BR /&gt;
CPU_ALL,CPU Total esbqpas11,User%,Sys%,Wait%,Idle%,Busy,PhysicalCPUs&lt;BR /&gt;
PCPU_ALL,PCPU Total esbqpas11,User ,Sys ,Wait ,Idle , Entitled Capacity&lt;BR /&gt;
SCPU_ALL,SCPU Total esbqpas11,User ,Sys ,Wait ,Idle&lt;BR /&gt;
PCPU01,PCPU 1 esbqpas11,User ,Sys ,Wait ,Idle&lt;BR /&gt;
PCPU02,PCPU 2 esbqpas11,User ,Sys ,Wait ,Idle&lt;BR /&gt;
SCPU01,SCPU 1 esbqpas11,User ,Sys ,Wait ,Idle&lt;BR /&gt;
SCPU02,SCPU 2 esbqpas11,User ,Sys ,Wait ,Idle&lt;BR /&gt;
SCPU03,SCPU 3 esbqpas11,User ,Sys ,Wait ,Idle&lt;BR /&gt;
MEM,Memory esbqpas11,Real Free %,Virtual free %,Real free(MB),Virtual free(MB),Real total(MB),Virtual total(MB)&lt;BR /&gt;
MEMNEW,Memory New esbqpas11,Process%,FScache%,System%,Free%,Pinned%,User%&lt;BR /&gt;
MEMUSE,Memory Use esbqpas11,%numperm,%minperm,%maxperm,minfree,maxfree,%numclient,%maxclient, lruable pages&lt;BR /&gt;
PAGE,Paging esbqpas11,faults,pgin,pgout,pgsin,pgsout,reclaims,scans,cycles&lt;BR /&gt;
PROC,Processes esbqpas11,Runnable,Swap-in,pswitch,syscall,read,write,fork,exec,sem,msg,asleep_bufio,asleep_rawio,asleep_diocio&lt;BR /&gt;
FILE,File I/O esbqpas11,iget,namei,dirblk,readch,writech,ttyrawch,ttycanch,ttyoutch&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:22:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120543#M32401</guid>
      <dc:creator>d29priyanka</dc:creator>
      <dc:date>2020-09-28T19:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120544#M32402</link>
      <description>&lt;P&gt;your regex seems not matching any part. which character in which line you are actually looking for to be this type? &lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2015 17:48:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120544#M32402</guid>
      <dc:creator>tonykung</dc:creator>
      <dc:date>2015-04-01T17:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120545#M32403</link>
      <description>&lt;P&gt;Actually I'm looking for all the first words before the comma i.e; AAA CPU_ALL MEM etc&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2015 17:55:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120545#M32403</guid>
      <dc:creator>d29priyanka</dc:creator>
      <dc:date>2015-04-01T17:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120546#M32404</link>
      <description>&lt;P&gt;Can someone help me to create a regex without using multikv?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os OR index=advantage sourcetype=nmon* | multikv|rex field=_raw "(?P[^,]+)"| dedup type|table type| sort type
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Apr 2015 18:14:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120546#M32404</guid>
      <dc:creator>d29priyanka</dc:creator>
      <dc:date>2015-04-01T18:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120547#M32405</link>
      <description>&lt;P&gt;if i were you i will create fields for all  like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "(?^[a-zA-z0-9]+)\s*,\s*note0" | rex "(?^[a-zA-z0-9]+)\s*,\s*note1"  ......
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Apr 2015 18:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120547#M32405</guid>
      <dc:creator>tonykung</dc:creator>
      <dc:date>2015-04-01T18:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120548#M32406</link>
      <description>&lt;P&gt;But i need output as  below into a field named type so that i could create a field :&lt;BR /&gt;
AAA&lt;BR /&gt;
CPU_ALL&lt;BR /&gt;
PCPU_ALL&lt;BR /&gt;
SCPU_ALL&lt;BR /&gt;
..&lt;BR /&gt;
..&lt;BR /&gt;
...&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:22:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120548#M32406</guid>
      <dc:creator>d29priyanka</dc:creator>
      <dc:date>2020-09-28T19:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120549#M32407</link>
      <description>&lt;P&gt;I believe this is what you want:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex "(?m)^(?P&amp;lt;type&amp;gt;([A-Za-z])[^,]+)" max_match=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you check out the doc on the rex command you'll see that &lt;CODE&gt;max_match=&lt;/CODE&gt; Controls the number of times the regex is matched. If greater than 1, the resulting fields will be multivalued fields. Defaults to 1, use 0 to mean unlimited.&lt;/P&gt;

&lt;P&gt;I'm not totally sure what you want to do with it after that, but you'll have a multivalue field with all the TYPE values as you designated... you can use eval and any number of mv... functions to manipulate the values.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2015 01:43:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120549#M32407</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2015-04-07T01:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and create a field named "type" using regex "(?m)^(?P([A-Za-z])[^,]+)" and multikv in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120550#M32408</link>
      <description>&lt;P&gt;Thank you for your reply.Now i get all the values into type field as below&lt;BR /&gt;
TOP &lt;BR /&gt;
NETSIZE &lt;BR /&gt;
DISKRIO &lt;BR /&gt;
DISKWIO &lt;BR /&gt;
DISKRXFER&lt;BR /&gt;&lt;BR /&gt;
DISKWRITE&lt;BR /&gt;&lt;BR /&gt;
DISKXFER&lt;/P&gt;

&lt;P&gt;But once i get values can i search by each type?&lt;BR /&gt;
Below query doesnt seem to work ..can someone help me with this?&lt;/P&gt;

&lt;P&gt;For example: index=os sourcetype="&lt;EM&gt;nmon&lt;/EM&gt;"  |rex "(?m)^(?P([A-Za-z])[^,]+)" max_match=0|search type=NETSIZE&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2015 16:31:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-create-a-field-named-quot-type-quot-using/m-p/120550#M32408</guid>
      <dc:creator>d29priyanka</dc:creator>
      <dc:date>2015-04-07T16:31:32Z</dc:date>
    </item>
  </channel>
</rss>

