Logging checked_for_custom_avatar

AI-generated summary

Logging checked_for_custom_avatar Discussion Summary

The discussion revolves around the excessive logging of checked_for_custom_avatar entries in Discourse’s staff action logs. watchmanmonitor initially reported 42,525 lines of such logs, which sparked a conversation about the necessity of these logs.

codinghorror agreed that the logging seemed absurd and suggested removing it. Upon further investigation, codinghorror found that these logs were per-user history entries verifying custom avatar lookups.

The logs in question were not under admin/logs but rather in admin/logs/staff_action_logs. watchmanmonitor confirmed that the excessive logs stopped in June 2014, suggesting an old bug.

codinghorror confirmed the issue and found that the logs stopped around May 27, 2014. techAPJ fixed the issue with a pull request. zogstrip explained that the entry was removed in a previous commit and pushed a database migration to remove the useless user history entries.

I just exported all my logs, and found something interesting.

checked_for_custom_avatar accounted for 42,525 lines,

check_email accounted for 364 (maybe that gets purged?)

the other 880 items were all quite varied.

I wonder if we could skip logging checked_for_custom_avatar ?

4 „Gefällt mir“

Whew! sounds like it could use it’s own log file.

Yes, this seems absurd, can we remove logging this @zogstrip?

1 „Gefällt mir“

I checked into this, and this is a per-user history entry that verifies we looked up their avatar.

context "a user who has been checked for a custom avatar" do
      before do
        UserHistory.create!(action: UserHistory.actions[:checked_for_custom_avatar], target_user_id: user.id )
      end

    # Finally, we don't check users whose avatars haven't been examined
    return unless UserHistory.exists_for_user?(@user, :checked_for_custom_avatar)

Which logs are you referring to? How are you exporting the per-user history logs? These are not under admin/logs AFAIK.

Also do you have 45,525 users? There should only be one of these records per user.

I was at [our forum]/admin/logs/staff_action_logs

I clicked the Export, and a while later received a notice that the export was ready.

We have about 500 users total.

I just did it again, same 2.4mb file, some 43785 lines.

I see that they mostly stopped in June of 2014… so maybe this was an old bug?

I wonder if there’s a reasonable way to purge all those?

Let me export our staff logs and get back to you.

edit: confirmed, we have a zillion of these rows as well in Staff Action Logs. That stopped about 5-27-2014. Looks like some kind of bug in the export process and/or an issue with the number of those records in the individual user histories. @techapj is having a look.

Fixed:

https://github.com/discourse/discourse/pull/3074

1 „Gefällt mir“

That’s because that entry is not used anymore and has been removed in

https://github.com/discourse/discourse/commit/6c1c8be79433f87bef9d768da7b8fa4ec9bb18d7

I pushed a database migration to remove these useless user history entries

https://github.com/discourse/discourse/commit/c57a1b393f0fefb9e3094514fa03c9c5046cc6f9

3 „Gefällt mir“