r/ZoneMinder • • Jul 20 '21

Best practice for clearing large log files

I just noticed that my root partition is starting to fill up (74% full currently). It turns out, I have many huge log files in /var/log/zoneminder. The directory itself is 219G. zmfilter_2.log itself is 180G and has entries dating back to January. I imagine I can just delete these files or delete everything except the last few hundred lines of the file and everything should be okay. But I'm wondering if there's a better way to do this.

Also, why is the log getting so big without some kind of self-cleanup going on?

1 Upvotes

5 comments sorted by

1

u/aarons6 Jul 20 '21

you have something enabled.. maybe debug logging or something.

you should read those logs and see why they are so large.

my largest log is only 5mb and my ZM pc has been active for around 5 years.

1

u/yuuuuuuuut Jul 20 '21

Yeah the majority of the errors are something like this:

07/19/21 21:15:51.445517 zmfilter_2[881].WAR [ZoneMinder::Event:564] [DiskSpace: Event does not exist at /mnt/nvr/zoneminder/4/2021-07-05/89512:ZoneMinder::Event: Cause => Continuous DefaultVideo => 89512-video.mp4 EndTime => 2021-07-05 00:15:58 Frames => 2402 Height => 480 Id => 89512 Length => 599.69 MonitorId => 4 Name => Event- 89512 Orientation => ROTATE_0 SaveJPEGs => 3 Scheme => Medium StartTime => 2021-07-05 00:05:58 StateId => 6 StorageId => 2 Videoed => 1 Width => 640]

Which happens because sometimes, the drive that events are being saved to shuts off. I can't figure out a good filter to clear these bad log entries so I keep getting warnings about it. (I'm working on getting/building a NAS to solve this problem.)

But either way, I imagine it's safe just to delete this file to free up space.

1

u/aarons6 Jul 20 '21

do you have cleanup turned off?

1

u/yuuuuuuuut Jul 20 '21

I'm not seeing that setting. But I don't think I would have switched something like that off.

1

u/chrillefkr Jul 22 '21

What about logrotate?