Log Cleaning / Removal

Logs stored on the robot can be deleted once they are successfully offloaded. Otherwise, they will slowly accumulate over time. Similarly, offboard, as you download logs locally, they can slowly consume all of your disk space.

Log Removal Onboard

As mentioned above, you can set the remove_after_offload configuration parameter for the offload stage to true. After logs are offloaded (and confirmed to be offloaded), they will be removed locally.

The second thing you can do is run the ’log cleaner stage’. This stage can be configured to keep (at most) some amount of disk space utilized. For example, you can say, “don’t use any more then 20GB of disk space for logs” with this tool.

The log cleaner will then run periodically and check to see if you are exceeding that limit. If so, it will delete entire logs, starting from the oldest log in the system.

Log Removal on your Desktop

It’s generally assumed that you are downloading all of your logs into a common directory. You can use the ark-log-cleanup-tool to scan that directory (and any subdirectories) and identify all of the logs you have downloaded, along with the disk space they are consuming.

$ ./build/ark-log-cleanup-tool ~/outside_logs/ -l
Manifest '864134bb-5b6b-4caf-bf49-deac5450dcd6' (MultiPlanNewArea, 2.2 GB)
Manifest 'f69dfe65-9464-42e7-a928-14329957700b' (service_mode_enabled, 134.6 MB)
Manifest 'd4c9a350-fe8c-4646-8253-f898caf45111' (Area_Fresh, 1.2 GB)
Manifest '3f9dece6-7f2d-44cf-b8c1-6373846aaa67' (Plan_Follower, 467.0 MB)

These are displayed from oldest to newest. There are a few ways you can delete logs from here. You can delete specific manifests, with:

$ ./build/ark-log-cleanup-tool ~/outside_logs/ -m f69dfe65-9464-42e7-a928-14329957700b --remove
Removing /home/mistake/outside_logs/manifests/f69dfe65-9464-42e7-a928-14329957700b
Removing /home/mistake/outside_logs/splits/01049e8f-490b-477b-ba6f-c1467a0d9fc6
Removing /home/mistake/outside_logs/splits/4660eee2-d0b0-46c5-855d-9b51611c58f1
Removing /home/mistake/outside_logs/splits/88b1fad4-a3b3-4d2e-b138-23684d300927
Removing /home/mistake/outside_logs/splits/d09e42a6-6325-4e2a-b2f7-ffdc9defdd3e
...

You must add --remove to the end of any command to delete logs; otherwise it defaults to a ‘dry run’ and just tells you what it’s going to do.

Finally, you can also prune logs, freeing up some amount of space. For example, you can tell it to remove logs until you have freed up at least 4GB of fresh space:

~/ark$ ./build/ark-log-cleanup-tool ~/outside_logs/ --prune-megabytes 4096 --remove
Removing /home/mistake/outside_logs/manifests/3f9dece6-7f2d-44cf-b8c1-6373846aaa67
Removing /home/mistake/outside_logs/manifests/864134bb-5b6b-4caf-bf49-deac5450dcd6
Removing /home/mistake/outside_logs/manifests/98e6571e-508e-4664-b956-71c763c05f9d
Removing /home/mistake/outside_logs/manifests/d4c9a350-fe8c-4646-8253-f898caf45111
Removing /home/mistake/outside_logs/splits/005fc886-0cfe-475d-a12f-14af744d7d4e
Removing /home/mistake/outside_logs/splits/017f4d21-6d04-426a-90a6-810b9233aab8
Removing /home/mistake/outside_logs/splits/0264d061-bbde-4b19-adff-2f7ecada9d9b
Removing /home/mistake/outside_logs/splits/045d1062-3d07-4a87-9c50-1ce42075c7c3
Removing /home/mistake/outside_logs/splits/05bb5d73-166d-4451-be6b-78c6c23edf51
...

Here, we see it deleted the four oldest logs in the system.