- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
VatsalJagani

SplunkTrust
05-08-2023
05:43 AM
Below is my CSV file format.
Time Span:,Full Time-span
Rate:,Cumulative
Scope:,Net
This is Table Header
Field1,Field2,Field3,Field4
Total1,/,1.20%,2.34%,N/A
Total2,/Total2,1.20%,2.05%,N/A
Total3,/Total/Total3,1.20%,N/A,N/A
Effect4,/Total/Total4,0.00%,N/A,N/A
- Here first 3 lines are common fields and values.
- 4th line is the table header (willing to extract that as a field as well if possible)
- The rest is the actual CSV file, I would like to extract it as field value pairs.
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

richgalloway

SplunkTrust
05-08-2023
09:52 AM
To do that you'll have to write a scripted input that parses the CSV and copies the common fields to each line in the file.
---
If this reply helps you, Karma would be appreciated.
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

richgalloway

SplunkTrust
05-08-2023
06:55 AM
What have you tried so far? Have you tried something like this in props.conf?
[mysourcetype]
INDEXED_EXTRACTIONS = csv
HEADER_FIELD_LINE_NUMBER = 4
DATETIME_CONFIG = current
---
If this reply helps you, Karma would be appreciated.
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
VatsalJagani

SplunkTrust
05-08-2023
09:42 AM
@richgalloway - This is helpful. Thanks!!!
But I would like to include common fields from the header to all the events, not sure if that is possible.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

richgalloway

SplunkTrust
05-08-2023
09:52 AM
To do that you'll have to write a scripted input that parses the CSV and copies the common fields to each line in the file.
---
If this reply helps you, Karma would be appreciated.
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
VatsalJagani

SplunkTrust
05-08-2023
09:27 PM
Yes, Python script is always an option, but I was wondering if it is possible without that. Something like KV_MODE=multi
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

richgalloway

SplunkTrust
05-09-2023
05:43 AM
There is no setting that does what you desire. KV_MODE = multi extracts fields from table-formatted data.
---
If this reply helps you, Karma would be appreciated.
If this reply helps you, Karma would be appreciated.
