You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[sshshim] persist debug file output with size limit (#549)
## Summary
This PR employs the `lumberjack` library to do log file rotation and
size limiting.
Previously, the log file would get truncated on each `sshshim` command
execution.
Now, it acts like a sane log file:
1. logs get added to it across multiple command executions
2. when it hits the 2MB size limit, it gets rotated:
- rotation copies to a backup file and the log file is truncated.
This will help us in debugging issues with premature mutagen session
termination. We can inspect the logs to understand why sshshim thought
that it should terminate the connections for the VM.
## How was it tested?
1. created a 2MB fake log file: `yes "this is test file" | head -c
2000000 > test.file` and copied it to
`~/.config/devbox/ssh/shims/logs.txt`
2. triggered an ssh shim command (`devbox cloud shell`) a few times.
3. observed the file get rotated:
```
❯ ls -al ~/.config/devbox/ssh/shims/
total 24
drwxr--r-- 6 savil staff 192 Jan 27 14:48 .
drwx------ 8 savil staff 256 Jan 27 14:48 ..
-rw-r--r-- 1 savil staff 4901 Jan 27 14:48 logs-2023-01-27T22-48-47.703.txt.gz
-rw-r--r-- 1 savil staff 1085 Jan 27 14:48 logs.txt
lrwxr-xr-x 1 savil staff 30 Jan 27 14:48 scp -> /Users/savil/golang/bin/devbox
lrwxr-xr-x 1 savil staff 30 Jan 27 14:48 ssh -> /Users/savil/golang/bin/devbox
```
0 commit comments