I want to remove admin logs (admin/logs/staff_action_logs) or disable staff logs?
How to?
No. You canât disable it.
Why would you want to do this?
I think database larger
Could you safely delete using postgres Sql?
thanks youÌ
Take a back-up before you start firing off commands though!
There are very few legitimate reasons to do thisâŠwhat is the reason?
First, @dangtrungluong , congratulations on having a forum thatâs so successful that you actually need to worry about the database size.
However, perhaps you should consider sharding / partitioning?
Generating more granular backups?
Simply deleting data is usually a poor idea likely to lead to unforeseen problems. What exactly is the problem youâre having that youâre wanting to solve?
@Mittineague iâm newbie joining to âdiscourseâ
If you are new to using discourse then I do not see what the issue is at the moment and why you feel it will make a massive impact on your database. We have logs going back to 2014 with no impact and I do not believe it takes up a massive amount of space.
Itâs not a bad thing to think about things before they become a problem. If anything, I donât think the database will be a problem as much as heavy weight media files could be. i.e. should you set up a CDN so the requests are served from closest to a visitors location? Do members reallly need to fill up a topic with mega weight files that could slow down page load and consume bandwidth?
hi. thank for all

VocĂȘ poderia fazer isso usando o console do Rails, mas tambĂ©m Ă© perigoso. EntĂŁo, se eu estiver correto, seria assim:
cd /var/discourse
sudo ./launcher enter app
rails c
Agora vocĂȘ estĂĄ no console, uma opção para excluir toda a ação de staff / logs de admin Ă© usar isto:
No entanto, isso remove tudo, o que pode nĂŁo ser o que vocĂȘ queria. VocĂȘ pode querer limitar o perĂodo de tempo ou investigar certas açÔes.
Por exemplo:
UserHistory.where(action: 17, acting_user_id: 5)
Isso retornaria todas as postagens excluĂdas pelo usuĂĄrio cujo ID Ă© 5.
ou
UserHistory.where(action: 17, post_id: 15643)
Isso retornaria informaçÔes sobre quem excluiu a postagem com o ID 15643.
Para uma lista de campos da tabela e IDs de ação, veja este arquivo:
# == Schema Information
#
# Table name: user_histories
#
# id :integer not null, primary key
# action :integer not null
# acting_user_id :integer
# target_user_id :integer
# details :text
# created_at :datetime not null
# updated_at :datetime not null
# context :string
# ip_address :string
# email :string
# subject :text
# previous_value :text
# new_value :text
# topic_id :integer
# admin_only :boolean default(FALSE)
# post_id :integer
# custom_type :string
# category_id :integer
#
# Indexes
#
# index_user_histories_on_acting_user_id_and_action_and_id (acting_user_id,action,id)
# index_user_histories_on_action_and_id (action,id)
# index_user_histories_on_category_id (category_id)
# index_user_histories_on_subject_and_id (subject,id)
# index_user_histories_on_target_user_id_and_id (target_user_id,id)
# index_user_histories_on_topic_id_and_target_user_id_and_action (topic_id,target_user_id,action)
#