Monitoring Splunk

log file rotate and flush conundrum

pkd18
Engager

Splunk forwarder monitors a file named AppLogs.txt. 3 times a day, a cron job copies the original file to a backup AppLogs.txt.timestamp and flushes the original file. Between the copy to backup and flush, the application writes some more logs into the original AppLogs.txt which is not captured by the splunk forwarder and lost when the original file is flushed. What would be the ideal solution to solve this problem?

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Monitor the rolled logs as well and ensure you're not using crcSalt = <SOURCE>. When you monitor the rolled logs as well, Splunk would know that it's a copy of the file already ingested (the CRC for the file would be same even if it's renamed) and would not re-ingest whole file again, just the new/missed content. You don't want to use crcSalt = <SOURCE> as it'll force the CRC to be generated based on full file path and the file path will change when you rename it, causing a re-ingestion.

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 ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...