<?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: Indexing a CSV with mixed sourcetypes. in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Indexing-a-CSV-with-mixed-sourcetypes/m-p/43161#M8049</link>
    <description>&lt;P&gt;After testing this, I found I have to use REPORT and not TRANSFORMS as it is a search time function. Editing original answer to reflect this&lt;/P&gt;</description>
    <pubDate>Thu, 22 Nov 2012 22:20:46 GMT</pubDate>
    <dc:creator>BobM</dc:creator>
    <dc:date>2012-11-22T22:20:46Z</dc:date>
    <item>
      <title>Indexing a CSV with mixed sourcetypes.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Indexing-a-CSV-with-mixed-sourcetypes/m-p/43159#M8047</link>
      <description>&lt;P&gt;In SPLUNK, can we index and search data with varying formats?&lt;/P&gt;

&lt;P&gt;We have a csv file containg events with different formats. Approximately there are 100 formats available. There is also a config file which can be used as a lookup to determine the column names of the corresponding record.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;BR /&gt;
If we need to put such data into Splunk, where and how we can specify the format for each event to be handled?&lt;/P&gt;

&lt;P&gt;The data format is something like this:&lt;BR /&gt;
&amp;nbsp;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Dept01,ABC,20120904,001500,Gn,3,ggss Test-City_gtpp,1,103031    Dept01,DEF,20120904,1500,1,13.17,86.83,277,1876288,34078720,2,3.34,96.66,235,1681068   Dept01,PQR,20120904,001500,24,3,0
Dept01,XYZ12,20120904,001500,Gi,2,abc-xyz.net.P2,67651,0,0,63419,R,0,G,10.208.0.0,abc-xyz.net.GP
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
The second column (ABC, PQR) are different source types, and each has varying column names and numbers. Since there are no key-value pairs, we cannot use EXTRACT.&lt;BR /&gt;
In this case, how can we populate the fields?&lt;BR /&gt;
&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Nov 2012 20:25:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Indexing-a-CSV-with-mixed-sourcetypes/m-p/43159#M8047</guid>
      <dc:creator>BobM</dc:creator>
      <dc:date>2012-11-22T20:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Indexing a CSV with mixed sourcetypes.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Indexing-a-CSV-with-mixed-sourcetypes/m-p/43160#M8048</link>
      <description>&lt;P&gt;I found this works. Set the sourcetype with a transform and regex then set the field names at search time.&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mycsvsourcetype]
TRANSFORMS-mysourcetyper = csvsourcetypes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[csvsourcetypes]
DEST_KEY = MetaData:Sourcetype
REGEX = ^\w*,(\w+),
FORMAT = sourcetype::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then back in the props.conf file for each source type&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ABC]
REPORT-abc = ABCfields

[DEF]
REPORT-def = DEFfields
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and back to transforms.conf to define the filed names&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ABCfields]
DELIMS = ","
FIELDS = "field1", "field2", "field3"

[DEFfields]
DELIMS = ","
FIELDS = "fieldA", "fieldB", "fieldC"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Nov 2012 20:27:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Indexing-a-CSV-with-mixed-sourcetypes/m-p/43160#M8048</guid>
      <dc:creator>BobM</dc:creator>
      <dc:date>2012-11-22T20:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Indexing a CSV with mixed sourcetypes.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Indexing-a-CSV-with-mixed-sourcetypes/m-p/43161#M8049</link>
      <description>&lt;P&gt;After testing this, I found I have to use REPORT and not TRANSFORMS as it is a search time function. Editing original answer to reflect this&lt;/P&gt;</description>
      <pubDate>Thu, 22 Nov 2012 22:20:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Indexing-a-CSV-with-mixed-sourcetypes/m-p/43161#M8049</guid>
      <dc:creator>BobM</dc:creator>
      <dc:date>2012-11-22T22:20:46Z</dc:date>
    </item>
  </channel>
</rss>

