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!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

New This Month - Observability Updates Give Extended Visibility and Improve User ...

This month is a collection of special news! From Magic Quadrant updates to AppDynamics integrations to ...

Intro to Splunk Synthetic Monitoring

In our last post, we mentioned that the 3 key pieces of observability – metrics, logs, and traces – provide ...