Getting Data In

Monitor is not working with Python-generated .csv

nick405060
Motivator

I have a .csv file that is being appended to every few minutes using Python. However, monitor reindexes everything each time it is written to, not just the new data. The filename and first 256 bytes are the same, so crcSalt shouldn't be an issue here.

How can I fix this?

0 Karma
1 Solution

nick405060
Motivator

Thanks to @micahkemp and @dwaddle for their assistance here. I posted this question to document the solution for the Splunk community.

micah:fez:  2:34 PM
if that file ever looks like it's less than 256 bytes, say right after it's re-created, but before it's written with the exact same content
2:35
splunk might be fast enough to catch it

duckfez:honk:  2:35 PM
p. sure it is, especially since I think inotify gets used (some) now

To solve, I just had Python write to a temp .csv and then I used shutil.move(temp.csv, myfinalfile.csv). It is possible that changing your Python code to write to the .csv using a instead of w may fix the issue as well.

View solution in original post

0 Karma

nick405060
Motivator

Thanks to @micahkemp and @dwaddle for their assistance here. I posted this question to document the solution for the Splunk community.

micah:fez:  2:34 PM
if that file ever looks like it's less than 256 bytes, say right after it's re-created, but before it's written with the exact same content
2:35
splunk might be fast enough to catch it

duckfez:honk:  2:35 PM
p. sure it is, especially since I think inotify gets used (some) now

To solve, I just had Python write to a temp .csv and then I used shutil.move(temp.csv, myfinalfile.csv). It is possible that changing your Python code to write to the .csv using a instead of w may fix the issue as well.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...