Getting Data In

Is it possible to add comments to lines in a CSV file?

mikesangray
Path Finder

Is it possible to add comments to lines in a csv file? I'd like to be able to #comment.

For example, csv list of IP ranges.
src
1.1.1.0/24 #comment
2.2.2.0/24 #comment

Tags (2)
0 Karma

mikesangray
Path Finder

Okay, I've got it working now. Thanks.

0 Karma

mikesangray
Path Finder

For now this is just a single lookup file used by "|inputlookup file.csv" stored in /opt/splunk/etc/system/lookups.

I'm using the file to exclude results from a search...so "if in lookup file, then don't return in search results, just give me everything else."

Soon I will transition it into a lookup table, indexed log file, or maybe even into a database and use db connect, but for now I'm still learning splunk and doing only newbie-style lookups.

0 Karma

jensonthottian
Contributor

Use some thing like this for "exclude results from a search...so "if in lookup file, then don't return in search results, just give me everything else."

your base search NOT [|inputlookup file.csv |table coloumnName]

This should do it.

0 Karma

somesoni2
Revered Legend

How is this CSV stored in Splunk?? Lookup table files OR it's indexed in some index??

0 Karma

tomaslo
Engager

Look at the answer here for a solution:
https://answers.splunk.com/answers/32704/lookup-tables-and-comments.html

Short:
Add a comment field and do not use that field in any reference.

0 Karma

jensonthottian
Contributor

CSVs the way you mean them are treated in a different way than regular log files.
There are 2 basic kinds:

"just CSVs", which are only accessed via "| inputcsv" and "| outputcsv"
lookup CSVs, which are accessed with commands "| lookup", "| inputlookup" and "| outputlookup"

Use the oputputcsv or outputlookup commands to add comment to your CSV in Splunk web

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

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 ...