1 Comment
User's avatar
User's avatar
Comment removed
Nov 23
Comment removed
System Design Course's avatar

To handle log files reliably when they get rotated—meaning the old file is renamed and a new one starts—you can't just keep an eye on the file itself. You have to watch the folder it lives in. That way, when the file changes names or a brand new one pops up, your monitoring system knows to switch its focus to the new, active log file immediately. Then, to keep things fast and not overload the network, you send the logs in smart batches: you either send them right away when you hit a big size limit (like 1MB) or after a very short timeout (like one second), whichever happens first. This keeps network traffic smooth and efficient even when you have tons of logs coming in.