<?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: SEDCMD extract multiple field from line in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74532#M15218</link>
    <description>&lt;P&gt;Hello eashwar!&lt;/P&gt;

&lt;P&gt;Thank you for your help!&lt;/P&gt;

&lt;P&gt;Unfortunately I need a little more...&lt;/P&gt;

&lt;P&gt;I do not need to remove all empty values. I need to extract the field with certain numbers, regardless of whether there is anything in this field or not. For example,source string of the form:&lt;BR /&gt;
1,2,3,4,5,6,7,8,9,0&lt;/P&gt;

&lt;P&gt;I need to get in result string (extract field №2,№5,№9):&lt;BR /&gt;
2,5,9 &lt;/P&gt;

&lt;P&gt;All field can contain a-z,A-Z,0-9 and _&lt;/P&gt;

&lt;P&gt;It is a problem...&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2013 09:33:16 GMT</pubDate>
    <dc:creator>ryastrebov</dc:creator>
    <dc:date>2013-03-26T09:33:16Z</dc:date>
    <item>
      <title>SEDCMD extract multiple field from line</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74530#M15216</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I have a log file containing a string with the values ​​separated by commas. For Example:&lt;BR /&gt;
&lt;EM&gt;,345,af04,&lt;/EM&gt;,&lt;EM&gt;,01,78932223442,&lt;/EM&gt;,&lt;EM&gt;,&lt;/EM&gt;,&lt;EM&gt;,24,&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;08,532,bcc01,&lt;EM&gt;,&lt;/EM&gt;,&lt;EM&gt;,&lt;/EM&gt;,345s,&lt;EM&gt;,&lt;/EM&gt;,&lt;EM&gt;,93,&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Between , is _ symbol (,_,). I want to extract from all lines only certain fields. For example, field number 2,3,7,12. &lt;/P&gt;

&lt;P&gt;Result is:&lt;/P&gt;

&lt;P&gt;345,af04,78932223442,24&lt;/P&gt;

&lt;P&gt;532,bcc01,_,93&lt;/P&gt;

&lt;P&gt;Field for extraction can contain _ symbol.&lt;/P&gt;

&lt;P&gt;How I can make it?&lt;/P&gt;

&lt;P&gt;My knowledges about regular expression is very small...&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;BR /&gt;
Roman&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 08:07:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74530#M15216</guid>
      <dc:creator>ryastrebov</dc:creator>
      <dc:date>2013-03-26T08:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD extract multiple field from line</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74531#M15217</link>
      <description>&lt;P&gt;hello i hope this will help you!!  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval fieldname =",345,af04,,,01,78932223442,,,_,,24,_" | rex field=fieldname mode=sed "s/(,,,|,,)/,/g s/(^,)//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;above worked for me in my splunk instance&lt;BR /&gt;&lt;BR /&gt;
add this line to your props.conf  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-removecommas=s/(,,,|,,)/,/g s/(^,)//g 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the above regular expression says if 3 commas or 2 commas found together replace with one comma. then find the coma in the line start and remove it.&lt;/P&gt;

&lt;P&gt;yours,&lt;BR /&gt;&lt;BR /&gt;
eashwar raghunathan&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 09:15:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74531#M15217</guid>
      <dc:creator>eashwar</dc:creator>
      <dc:date>2013-03-26T09:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD extract multiple field from line</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74532#M15218</link>
      <description>&lt;P&gt;Hello eashwar!&lt;/P&gt;

&lt;P&gt;Thank you for your help!&lt;/P&gt;

&lt;P&gt;Unfortunately I need a little more...&lt;/P&gt;

&lt;P&gt;I do not need to remove all empty values. I need to extract the field with certain numbers, regardless of whether there is anything in this field or not. For example,source string of the form:&lt;BR /&gt;
1,2,3,4,5,6,7,8,9,0&lt;/P&gt;

&lt;P&gt;I need to get in result string (extract field №2,№5,№9):&lt;BR /&gt;
2,5,9 &lt;/P&gt;

&lt;P&gt;All field can contain a-z,A-Z,0-9 and _&lt;/P&gt;

&lt;P&gt;It is a problem...&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 09:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74532#M15218</guid>
      <dc:creator>ryastrebov</dc:creator>
      <dc:date>2013-03-26T09:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD extract multiple field from line</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74533#M15219</link>
      <description>&lt;P&gt;hello there, &lt;BR /&gt;
you if you can create a new thread with a sample event in it i can help you with your extract.&lt;BR /&gt;
you may have to use EXTRACT-xxxxx in props.conf&lt;BR /&gt;
or you can also use DELIMIT in&lt;BR /&gt;&lt;BR /&gt;
DELIMS = ","&lt;BR /&gt;
FIELDS = "field1", "field2", "field3"&lt;BR /&gt;
this is transforms.conf&lt;/P&gt;

&lt;P&gt;consider voting for the answer above if the answer is correct and helped you.&lt;/P&gt;

&lt;P&gt;thank you,&lt;BR /&gt;
eashwar raghunathan&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 09:46:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74533#M15219</guid>
      <dc:creator>eashwar</dc:creator>
      <dc:date>2013-03-26T09:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD extract multiple field from line</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74534#M15220</link>
      <description>&lt;P&gt;Thank you for your answer!&lt;/P&gt;

&lt;P&gt;I'll look for a solution to my problem using the TRANSFORMS&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 10:19:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74534#M15220</guid>
      <dc:creator>ryastrebov</dc:creator>
      <dc:date>2013-03-26T10:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD extract multiple field from line</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74535#M15221</link>
      <description>&lt;P&gt;And what of the presented method is recommended for performance? I need extract this fields before indexing...&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 10:46:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74535#M15221</guid>
      <dc:creator>ryastrebov</dc:creator>
      <dc:date>2013-03-26T10:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD extract multiple field from line</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74536#M15222</link>
      <description>&lt;P&gt;Extraction are done in index time and search time.&lt;BR /&gt;&lt;BR /&gt;
i am also a new to splunk.&lt;BR /&gt;&lt;BR /&gt;
if you call a transform.conf variable using REPORT form props.conf it will do the extraction in search time.&lt;BR /&gt;&lt;BR /&gt;
if you call a transforms.conf variable using TRANSFORMS from props.conf it will do the extraction in index time.   &lt;/P&gt;

&lt;P&gt;if you are using TRANSFORMS in your props.conf after the data is indexed make sure you do the following to reindex all the data.&lt;BR /&gt;&lt;BR /&gt;
step 1 : stop splunk &lt;CODE&gt;./splunk stop&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;
step 2 : clean the index &lt;CODE&gt;./splunk clean eventdata &amp;lt;yourindexname&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;
step 3: start splunk &lt;CODE&gt;./splunk start&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;if you want to clean your full splunk instance replace step 2 by &lt;CODE&gt;./splunk clean all&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;hope this will help you,&lt;BR /&gt;&lt;BR /&gt;
yours,&lt;BR /&gt;&lt;BR /&gt;
eashwar raghunathan&lt;BR /&gt;&lt;BR /&gt;
happy splunking&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 11:40:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74536#M15222</guid>
      <dc:creator>eashwar</dc:creator>
      <dc:date>2013-03-26T11:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD extract multiple field from line</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74537#M15223</link>
      <description>&lt;P&gt;Thank you for your great help, eashwar!&lt;/P&gt;

&lt;P&gt;You described approach is very good.&lt;/P&gt;

&lt;P&gt;I am a new in regular expression and I have difficulties with write regex in transforms.conf file for my situation.&lt;/P&gt;

&lt;P&gt;Can you help me with it?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 11:54:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74537#M15223</guid>
      <dc:creator>ryastrebov</dc:creator>
      <dc:date>2013-03-26T11:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD extract multiple field from line</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74538#M15224</link>
      <description>&lt;P&gt;sure i can help you with it. &lt;BR /&gt;
all you have to do is. update your question with one sample event. followed by field=value.&lt;BR /&gt;
what value should be assigned to what field.&lt;BR /&gt;
consider creating a new thread so that splunk guys dont get annoyed of hijacking threads.&lt;BR /&gt;
happy splunking,&lt;BR /&gt;
comment the link to the new thread hear&lt;BR /&gt;
yours,&lt;BR /&gt;
eashwar raghunathan&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2013 12:02:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-extract-multiple-field-from-line/m-p/74538#M15224</guid>
      <dc:creator>eashwar</dc:creator>
      <dc:date>2013-03-26T12:02:10Z</dc:date>
    </item>
  </channel>
</rss>

