hyperdx/docker
Dan Hable 0b19f915e8
fix(otel-collector): fix log rotation script (#1479)
There were two issues with the log rotation script:

1. Logs could be lost since copying and then truncating the file might not finish before logs arrive.

2. The otel collector application will keeps the file handle and offset cached. After truncating, it will write starting at the last offset leaving the unallocated garbage in the beginning of the file. This garbage uses space.

This commit moves the file instead of copying. That allows the collector to continue writing to the rolled file until a SIGHUP is sent. This causes a config refresh, which also opens a new log file. After, the rolled file and the new log file have correct sizes.

--
**ADDITIONAL NOTES**: 

Claude's code review is not accurate here.

* The alpine image is based on busybox and fuser is a command implemented by busybox. This can be verified by just running the collector and watching the log rotate behavior.
* The mv command updates the name of the file in the file system but doesn't change the inode number. A process only uses the file path the first time the file is open to resolve it into a inode number. Moving the file changes the name but doesn't change the inode number so the process will continue to write to that file.
2025-12-15 16:08:11 +00:00
..
clickhouse/local feat: Add ClickHouse JSON Type Support (#969) 2025-07-03 17:11:03 +00:00
hostmetrics chore: remove unused dependencies (#791) 2025-05-06 03:13:20 +00:00
hyperdx chore: Update to next 16, react 19, add react compiler (#1434) 2025-12-04 23:40:59 +00:00
nginx feat: add example nginx ssl reverse proxy service (#535) 2024-12-17 18:29:54 +00:00
otel-collector fix(otel-collector): fix log rotation script (#1479) 2025-12-15 16:08:11 +00:00