Splunk Dev

Help using outputlookup command to display fields on CSV header.

jip31
Motivator

Hi,

I use a scheduled search in order to generate a CSV lookup automatically:

 

patch

 

 

 

| table Computer Site OSVersion
| rename Computer as host
| outputlookup host.csv

 

 

But on the first line of the CSV, I need to display the 3 fields on the header like host, site, and OS version.

If I add these fields in the CSV before running the search, I would like to know if these fields are going to be deleted when the search is finished?

Thanks.

Labels (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @jip31 ,

You can use outputlookup on an existing lookup, so you can create the lookup header (with the fields you like) using e.g. Lookup Editor App.

What do you need to create: a lookup or a csv file?

If a lookup, you don't need to insert header.

If a csv file, use outputcsv instead outputlookup and header is automatically inserted.

You could also add the header but it it's unuseful.

Ciao.

Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @jip31 ,

You can use outputlookup on an existing lookup, so you can create the lookup header (with the fields you like) using e.g. Lookup Editor App.

What do you need to create: a lookup or a csv file?

If a lookup, you don't need to insert header.

If a csv file, use outputcsv instead outputlookup and header is automatically inserted.

You could also add the header but it it's unuseful.

Ciao.

Giuseppe

0 Karma

FrankVl
Ultra Champion

The outputlookup command will put the header row in place as well.

0 Karma
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...