- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to find CSV issue?
We have error messages like " Corrupt csv header in CSV file , 2 columns with the same name 'Severity" & CSV file contains invalid field ''. How do I find this? My SHC has hundreds of CSV files, so it is hard to find issues even with grep.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
To find and fix CSV header errors in multiple files, write a script to check for duplicate column names and invalid fields in the header row. Then, run the script on your CSV file directory.
For Python, a basic example might look like this:
import csv
import os
def check_csv_headers(file_path):
with open(file_path, 'r') as csvfile:
csvreader = csv.DictReader(csvfile)
headers = csvreader.fieldnames
if len(headers) != len(set(headers)):
print(f"Duplicate columns in: {file_path}")
if '' in headers:
print(f"Invalid field name in: {file_path}")
# Directory containing CSV files
directory = '/path/to/csv/files'
for filename in os.listdir(directory):
if filename.endswith('.csv'):
file_path = os.path.join(directory, filename)
check_csv_headers(file_path)
Save the script to a file, make it executable (if needed), and run it against your directory containing the CSV files.
python check_csv_headers.py
This approach automates the process of scanning your CSV files for errors and should help you efficiently locate and fix these issues across multiple files within your Splunk Heavy Forwarder.
You can also check https://community.splunk.com/t5/Knowledge-Management/bd-p/knowledge-management/CCSP Certification
Thank you
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content


I've only seen those messages in search results so it's pretty easy to check the few lookups in my search. It becomes more difficult when there are automatic lookups to check. The search log should have more information, though.
If this reply helps you, Karma would be appreciated.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not in the search results as I get it, rather it's tracked by Mongo and that is how we're seeing it. So I don't have search.log indexed into Splunk and therefore have no visibility.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content


I'm not sure what you mean by "tracked by Mongo". If there a corrupt KVStore lookup then you should be able to scan your collections.conf files for duplicate names, but would think problems there would be reported differently..
If this reply helps you, Karma would be appreciated.
