Getting Data In

outputcsv - append field value in filename

vb1612
New Member

I have field name xyz , want to append value of this field in outputcsv filename

Tags (1)
0 Karma

koshyk
Super Champion

Something like this..

<your_search_to_get_xyz field>
|eval myCSVFile=xyz
| map search="search index=_internal| fields host,sourcetype,source|outputlookup $myCSVFile$.csv"

Above is an example.. Change it to your own searches to generate the xyz field and then apply it to the output of another search to generate outputlookup

0 Karma

DavidHourani
Super Champion

Hi @vb1612,

Where is your field located ? Is it in an index ? Are you trying to combine fields from multiple sources ?

Official documentation for output CSV is in Splunk docs :
https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Outputcsv

So all you have to do is make sure your field is there before you run the outputcsv command:

index=yourindex sourcetype=yoursourcetype | fields fields_you_want_to_keep | outputcsv MyTestCsvFile

Pease provide some sample data if you want you help with your specific SPL.

Cheers,
David

0 Karma
Get Updates on the Splunk Community!

Routing Data to Different Splunk Indexes in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. The OpenTelemetry project is the second largest ...

Getting Started with AIOps: Event Correlation Basics and Alert Storm Detection in ...

Getting Started with AIOps:Event Correlation Basics and Alert Storm Detection in Splunk IT Service ...

Register to Attend BSides SPL 2022 - It's all Happening October 18!

Join like-minded individuals for technical sessions on everything Splunk!  This is a community-led and run ...