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
Revered Legend

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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

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