Getting Data In

splunk handling csv file with each line have different format

ahmedhassanean
Explorer

dears,

I have CSV file consist for example of multiple numbers of line each line has different header and length depending on word in the line for example if column two in file contains cpu then it will have header with 8 columns but if contain memory word it will have another header with 3 columns I had preprocessing script that was grepping file for word and create new file with correct header and set sourcetype in splunk as csv but this script is inefficient in large files so may i know if there is any solution direct from splunk that make me not use this script note number of different header is above 200 hundred

Tags (1)
0 Karma

ahmedhassanean
Explorer

for example log file will contain below
coulmn1,cpu,coulmn2,coulmn3,coulmn4,coulmn5
coulmn1,memory,coulmn2,coulmn3,coulmn4,coulmn5,coulmn6,coulmn7,coulmn8,coulmn9
coulmn1,diskio,coulmn2,coulmn3

header files contain below:
for cpu header as below :
metricx,metricz,metrixy,metric3,metric4,coulmn5

for memroy header it will be as below :

metric1metricx,metric2,metric3,metric4,metric5,metric6,metric7,metric8,metric9

0 Karma

xpac
SplunkTrust
SplunkTrust

Could you show us a few lines of example data?

Although I'm pretty sure what you're trying to achieve will either be not possible or pretty complicated, but let's see.

0 Karma
Get Updates on the Splunk Community!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...