User Upload Reporting & Quota

AI 生成的摘要

The discussion addresses the need for granular control over user upload quotas to manage disk space usage effectively. fearlessfrog initiates the thread by requesting two features: a dashboard to view per-user upload capacity in MB and a trust-based or per-user quota system that warns staff or blocks uploads upon exceeding limits. This stems from a recent incident where disk space depleted rapidly, and the existing global warning for low host disk space (discussed by codinghorror) was insufficient for identifying specific culprits.

While codinghorror notes the existing “download remote images threshold” setting, zogstrip clarifies that this only affects remote image downloads, not local direct uploads. fearlessfrog confirms this, noting that while the global warning stopped remote downloads, it did not prevent users from uploading files, leaving admins to manually investigate via SQL or Rails.

Mittineague suggests leveraging trust levels to implement a FIFO (First-In-First-Out) cleanup strategy, where new uploads trigger the removal of older orphaned files. However, clay argues against automatic deletion in corporate environments, as it could disrupt other members’ access to older files. Instead, clay recommends a system that warns users and admins when quotas are reached and prevents further uploads until an admin manually adjusts the quota. The group also discusses the default settings for cleaning orphan uploads, with fearlessfrog asking if there is an easy way to query files waiting in the purge grace period.

We had a recent need to find where our uploads size was increasing quickly, so this feature request breaks down into two ideas:

(1) A way to see per user the file upload capacity used, i.e. a per user total uploads in mb.

(2) A trust-based or per-user upload quota limit that would either warn staff/admin that a quota was exceeded or prevent further uploading until the quota was increased.

Our support experience I am basing this request for feature discussion is here:

5 个赞

There’s already a related warning that is sent when the entire host disk has less than 10% free space remaining:

download remote images threshold

Minimum disk space necessary to download remote images locally (in percent)

When that gets triggered, remote images in posts are no longer downloaded locally and converted to local images. However I don’t know that it also blocks local direct uploads @zogstrip?

1 个赞

Yep, that feature was very useful, and provided our first heads-up. The setting can also be tweaked from the default 10% too. After we got that warning and it ticked itself off (stopping local copy downloads) I don’t think direct uploads were stopped (actually fairly sure it didn’t).

The question was then what to do afterwards, i.e. check it wasn’t just Ubuntu gorging on security updates or something that Discourse users were busy with. I was ok because I could write a bit of SQL or navigate within Rails, but the feature is more for those not able/wanting/blessed/cursed to be doing that.

Like minds.

I was thinking the same thing. Something like a FIFO “you are almost out of upload space do you wish to continue?” - “warnimg if you continue some of your earlier uploads will be removed to make room for this one”

Are these Settings checked and 1 ?

clean up uploads
Remove orphan unreferenced uploads to prevent illegal hosting. WARNING: you may want to back up of your /uploads directory before enabling this setting.

clean orphan uploads grace period hours
Grace period (in hours) before an orphan upload is removed.

1 个赞

Yep, all left as default. We are tempted to lower the 30 day default of ‘purge deleted uploads grace period days’, as that might help, but not quite sure what it does. Is there an easy query to find out what’s waiting there?

2 个赞

This isn’t a good idea. In corporate environments, it could inconvenience other company members if earlier files are removed. In these instances, the solution likely will come from the IT department migrating to a larger server or something. I would recommend that you warn users that they are about out of space and then prevent them from uploading more if they run out, triggering a warning to the admins. Also, give the admins the ability to set blanket and per-user quotas for uploads and to individually increase an upload quota for a user, when needed.

3 个赞

Nope, it’s only used when pulling external images.

2 个赞