<?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 import some columns from csv in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358671#M95954</link>
    <description>&lt;P&gt;My rule on CSVs is this:  If the file does NOT contain a timestamp, it should NOT be indexed (do not use &lt;CODE&gt;Add data&lt;/CODE&gt;.  Instead, it should be uploaded as a lookup.  If you must index this data, then use &lt;CODE&gt;SEDCMD&lt;/CODE&gt; to skip (erase) columns in your data as it is indexed:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.0/Data/Anonymizedata"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.0/Data/Anonymizedata&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jun 2017 14:50:47 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-06-20T14:50:47Z</dc:date>
    <item>
      <title>how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358669#M95952</link>
      <description>&lt;P&gt;I have a csv file to import by app data -&amp;gt;monitor&lt;BR /&gt;
i would to import some columns (not all) before to index.&lt;BR /&gt;
It's possible?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 13:03:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358669#M95952</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2017-06-20T13:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358670#M95953</link>
      <description>&lt;P&gt;Hi splunk6161,&lt;BR /&gt;
I didn't tried to do this, but you could delete columns that you don't want to index using a SEDCMD command.&lt;BR /&gt;
e.g. if you have a csv like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;field1,field2,field3,field4,field5,field6
aaa,bbb,ccc,ddd,eee,fff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and you don't want to index field4&lt;/P&gt;

&lt;P&gt;you could insert in props.conf stanza:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
 SED-alter=s/[^,],[^,],[^,],[^,],[^,],[^,]/[^,],[^,],[^,],[^,],,[^,]/g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try it&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 14:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358670#M95953</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-06-20T14:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358671#M95954</link>
      <description>&lt;P&gt;My rule on CSVs is this:  If the file does NOT contain a timestamp, it should NOT be indexed (do not use &lt;CODE&gt;Add data&lt;/CODE&gt;.  Instead, it should be uploaded as a lookup.  If you must index this data, then use &lt;CODE&gt;SEDCMD&lt;/CODE&gt; to skip (erase) columns in your data as it is indexed:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.0/Data/Anonymizedata"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.0/Data/Anonymizedata&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 14:50:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358671#M95954</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-20T14:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358672#M95955</link>
      <description>&lt;P&gt;It doesn't work&lt;BR /&gt;
I have 10columns plus 1column "_time" as first column.&lt;BR /&gt;
I would keep the first column, skip the second and the third, keep the rest.&lt;BR /&gt;
Is correct this scenario?&lt;BR /&gt;
SEDCMD-alter=s/[^,],[^,],[^,],[^,],[^,],[^,],[^,],[^,],[^,],[^,],[^,]/[^,],,,[^,],[^,],[^,],[^,],[^,],[^,],[^,],[^,]/g&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 15:56:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358672#M95955</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2017-06-22T15:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358673#M95956</link>
      <description>&lt;P&gt;Do this in &lt;CODE&gt;props.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourSourcetypeHere]
SEDCMD-trim_raw = s/([^,]+),(?:[^,]+,){2}(.*$)/\1\2/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For proof try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| fields - _time
| eval _raw="_time,f1,f2,f3,f4,f5,f6,f7,f8,f9,f10" 
| rex mode=sed "s/([^,]+),(?:[^,]+,){2}(.*$)/\1\2/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/530547/filter-data-and-extract-field-before-indexed.html#comment-541998"&gt;https://answers.splunk.com/answers/530547/filter-data-and-extract-field-before-indexed.html#comment-541998&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 19:45:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358673#M95956</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-22T19:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358674#M95957</link>
      <description>&lt;P&gt;I've created a new csv to do a test:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3086iFCDE8618DFFD5877/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;did this in props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[csv_n402_rex]
BREAK_ONLY_BEFORE_DATE = 
DATETIME_CONFIG = 
FIELD_DELIMITER = ,
INDEXED_EXTRACTIONS = csv
KV_MODE = none
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
SEDCMD-rex = s/([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).([^,]+).*/\4,\12,\14,\17\n/
SHOULD_LINEMERGE = false
category = Structured
description = Comma-separated value format. Set header and other settings in "Delimited Settings"
disabled = false
pulldown_type = 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In search works, when I add *&lt;EM&gt;| table *&lt;/EM&gt;* in the search, it shows me all fields. Why?&lt;BR /&gt;
I suppose regex is just a view, so I'm indexing all the fields.&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3087i27B6DC0D2AEDFBF7/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 15:53:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358674#M95957</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2020-05-05T15:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358675#M95958</link>
      <description>&lt;P&gt;because &lt;CODE&gt;INDEXED_EXTRACTIONS = csv&lt;/CODE&gt; is before &lt;CODE&gt;SEDCMD-rex&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;|table *&lt;/CODE&gt; display all extracted fields.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 17:56:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358675#M95958</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-05T17:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358676#M95959</link>
      <description>&lt;P&gt;so I'm indexing all the fields?&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 08:56:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358676#M95959</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2020-05-06T08:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358677#M95960</link>
      <description>&lt;P&gt;yes , I guess&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 09:10:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358677#M95960</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-06T09:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358678#M95961</link>
      <description>&lt;P&gt;I tried to reverse as you said but the sorting of the fields would seem to be automatic and so like in the props.conf file above&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 09:14:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358678#M95961</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2020-05-06T09:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358679#M95962</link>
      <description>&lt;P&gt;How about transforms.conf ?&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 10:59:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358679#M95962</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-06T10:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to import some columns from csv</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358680#M95963</link>
      <description>&lt;P&gt;not present, i'll try to configure it.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 12:17:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-import-some-columns-from-csv/m-p/358680#M95963</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2020-05-06T12:17:14Z</dc:date>
    </item>
  </channel>
</rss>

