Logging checked_for_custom_avatar


(Allen - Watchman Monitoring) #1

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 ?


(Mittineague) #2

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


(Jeff Atwood) #3

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


(Jeff Atwood) #4

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.


(Allen - Watchman Monitoring) #5

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?


(Jeff Atwood) #6

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.


(Arpit Jalan) #7

Fixed:

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


(Jeff Atwood) #8

(Régis Hanol) #9

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