Monitor File & Directory Changes App

Hello!

In my usecase (small team), mistakes happen: people accidentally move huge directories, people accientally delete a lot of files. Sometimes the server or sync client does funny things, and files become 0 bytes in size. Luckily I can restore files from trash, or move directories back. But how do I find out that something went wrong?

Enter the app “Monitor File & Directory Changes”.

Settings/capabilities:

  • show directories where more than X files were deleted within a 1 hour period
  • show directories where more than X files were added within a 1 hour period
  • show deleted directories
  • show files whose size has decreased more than X MB (or X percent?)
  • show files with file size 0 B

The view would be just like the view for the server log, and it would refresh automatically, and show you the most recent events, and if you scroll down you see older events.

I am actually surprised I cannot find desktop apps that do this. There is qdirstat which goes in that direction, but I would have to write scripts to work with it’s output, and I can’t do that.

What do you think?

Have you considered removing write access from your files and folders to stop people from deleting them?

@alexanderdd
The problem is that Nextcloud is a software for collaborative work. Users can intentionally or unintentionally modify files and folders based on their access rights. Mechanisms such as the recycle bin try to address some of these errors.

I could imagine that within statistic tools certain evaluations are conceivable. But I think that your wishes go too far. It is at least for me normal that I move whole directories into the trash from time to time and delete them afterwards.

As a tip I would like to recommend the app Group folders. Here you can prevent the deletion of files and folders through limited user rights.

Maybe you can use tools outside of Nextcloud. But far more important are backups

Thanks for the comments!

I don’t want to remove write access or prevent the deletion of folders, because often, the user action is intentional/correct/necessary. I just want a way to monitor big changes, without looking at all changes in the activities app.

Maybe it’s also an idea to have a sidebar entry “big/unusual changes” in the activities app?

Do you make (incremental) backups e.g. with rsync --link-dest? Maybe you can use the log of the incremental backup to find anomalies. Important is actually only to control the daily backup.

But yes. just as there is intrusion detection, it might be nice to be able to detect user anomalies if you can reasonably determine when that is the case.

I often copy full directorys and delete them afterwards. Hopefully the backup is correct and on error there is a restore.

Yes of course.

Looking at those logs might be an idea, thanks. Anyway, I was hoping for an easy overview, potentially within Nextcloud.

The same problem used to exist with network drives. It also happens that someone accidentally deletes or moves something. There are probably no better solutions than the backup from the day before. Since errors are often detected late, it is also necessary to keep older backups on hand.

Your idea is cool, but use the existing tools like group folders and workspace to address your issues with deletion.

Take a look at user groups and how they work. Sounds like you haven’t used them, so definitely worth a try. Thankfully, these tools allow a more granular approach than one would assume.

https://docs.nextcloud.com/server/stable/admin_manual/configuration_user/user_configuration.html

Hope it helps.

1 Like

@alexanderdd I’m absolutely with you on that one. I seem to remember that there was an app capable of monitoring user actions and showing them to admins, just like “Activities for shared file downloads, visible to all admins”.

In my scenario I have a handful of problematic users who will cut files and forget to paste them back, move to some random location or simply delete and comeback crying that something went missing.

We use Group folders, permissions, flow with automated file blocking, yet someone still manages to mess things up. We have backups and I can recover all and any file but without logging I can’t educate people to get things done properly. Additionally, some logs would be great to monitor desktop client activities as lately I’m very suspicious of its reliability.

Yes I still think this would be useful (maybe also a new entry “big/unusual changes” in the activities app).

Sometimes I use Qdirstat to check the number of files in folders, but it only helps a little, not systematically - I need automatic alerts.

It might be possible to create something with the https://apps.nextcloud.com/apps/analytics by analyzing the nextcloud log (which has all the info about moved/deletes files & folders), but I am not good enough to do that myself.