ULG files are taking 25 GB disk space

Solution 1:

According to a similar question in an Intel forum, Disk fills up, large ULG files in /var/lib/mavlink-router, these ULG files are logfiles of the mavlink-router.

There are only two workarounds:

  • Either disable logging:

    Modify /etc/mavlink-router/main.conf and comment out the line below:

    [General]
    #Log=/var/log/mavlink-router
    
  • Or setup a cronjob to delete them regularly once a day:

    0 2 * * * rm /var/lib/mavlink-router/*.ulg && systemctl restart mavlink-router.service
    

At first, I thought logrotate with the following snippet could be of help:

/var/lib/mavlink-router/*.ulg {
    rotate 2
    daily
    missingok
    notifempty
    compress
    sharedscripts
    postrotate
        systemctl restart mavlink-router.service
    endscript
}

But this won't work as intended because the filenames already have a timestamp and number in them, so each file has a different name and logrotate would simply compress them but never delete them. E.g. 00000-2018-05-22_05-14-52.ulg would become 00000-2018-05-22_05-14-52.ulg.1.gz but never get deleted because there won't be another file with that name that claims its place.

See this post for a possible solution with logrotate for files with timestamps in their name.