All Apps and Add-ons

Loading a comma seperated values file without headers into SPLUNK with custom headers

nageshreddy81
New Member

I have to load a file from hadoop into SPLUNK which are comma separated with no headers. I want to display results with the field headers. Can some guide me the process/steps for adding the headers.

I am using Hadoop Connect app for the above.

Tags (1)
0 Karma

sideview
SplunkTrust
SplunkTrust

You'll want to set up an AutoHeader stanza in transforms.conf for your sourcetype.

It's a smaller part of the overall check_for_header config ( http://docs.splunk.com/Documentation/Splunk/5.0.2/Data/Extractfieldsfromfileheadersatindextime ) And although you have no header to check, you can still manually set up the autoheader so that the fields all get extracted, and with the right field names assuming you know the field names.

Assuming for the moment that your sourcetype is called "mySourcetype", This would go in transforms.conf

[AutoHeader-mySourcetype]
FIELDS="foo", "bar", "anotherfoo", "anotherbar"
DELIMS=","

and add this to props.conf, under the stanza [mySourcetype]. If there already is a [mySourcetype] stanza, just add the REPORT line under the existing stanza by itself.

[mySourcetype] 
REPORT-AutoHeader = AutoHeader-mySourcetype
0 Karma

sideview
SplunkTrust
SplunkTrust

Maybe try modifying the config in splunk/etc/system/local, rather than just in the user directory. It seems unlikely to be the cause but it shouldn't be hidden in a user dir.

I would also explicitly give your data a sourcetype. Just make up a sourcetype name and stick with it. The "ini-too_small" name means that you asked Splunk to figure it out, it couldn't and furthermore the file wasn't big enough for it to get a proper signature. It has fallback behavior to take the file extension and tack on "too_small", but the resulting sourcetype may be a little strange, I dont know.

0 Karma

nageshreddy81
New Member

I tried to make the changes as suggested by you, but it does not work 😞

Following is sample data, although the actual data is complicated, this is for test purpose.
File Name is "comma.ini"
nagesh,test
nagesh,test1

My props.conf entry:
[ini-too_small]
REPORT-AutoHeader = AutoHeader-ini-too_small

My transforms.conf entry:
[AutoHeader-ini-too_small]
FIELDS="foo", "bar"
DELIMS=","

The sourcetype ini-too_small is assigned by splunk automatically.

I have modified props.conf and transforms.conf in the splunk/etc/users/admin/search/local

Let me know were i am going wrong here.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...