Splunk Search

WatchedFile - File too small to check seekcrc, probably truncated. Will re-read entire file

max8006
Explorer

Hello
I have a script that writes a log file of the current month. The information is exported from a database. It always writes the whole month. It does not matter if there are new entries or not. If there are new entries, they will be appended to the end of the file.
This log file is monitored by Splunk. I think the re reading takes place at the moment the script fills the line of the log file and is not finished, and at the same time Splunk checks the file and recognizes there is a difference.
My workaround is to copy the file to a different location when the script finishes exporting. And Splunk only checks the file at the new copy location. Now I do not have such reading errors anymore.
My question is whether my approach is right or if there is a better way. The problem I have is that I can not access the database directly.
thank you in advance

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

If you're rewriting files from the beginning then yeah, writing them elsewhere and finally moving/renaming them to a splunk-monitored location is the way to go.

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

If you're rewriting files from the beginning then yeah, writing them elsewhere and finally moving/renaming them to a splunk-monitored location is the way to go.

0 Karma

ddrillic
Ultra Champion

Maybe you can write the output from the DB into a file and compare its contents against the Splunk's monitored file and add to the Splunk one the difference. Like this you hide your process from Splunk.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...