# Entfernen spezifischer Mitarbeiteraktionsprotokolle über die Konsole

**URL:** https://meta.discourse.org/t/removing-specific-staff-action-logs-using-the-console/312393
**Category:** Development
**Tags:** rails-console
**Created:** [17. Juni 2024 um 13:45 UTC](https://meta.discourse.org/t/removing-specific-staff-action-logs-using-the-console/312393 "2024-06-17T13:45:51Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Isambard](https://avatars.discourse-cdn.com/v4/letter/i/858c86/32.png) [@Isambard](https://meta.discourse.org/u/Isambard)
#### Post date: [17. Juni 2024 um 13:45 UTC](https://meta.discourse.org/t/removing-specific-staff-action-logs-using-the-console/312393/1 "2024-06-17T13:45:51Z")

</div>

Fortsetzung von: [Don't log all post edits in staff action logs for a user-merge - #4 by JammyDodger](https://meta.discourse.org/t/dont-log-all-post-edits-in-staff-action-logs-for-a-user-merge/312376/4)

Danke. In der Zwischenzeit, wenn ein Rails-Konsolen-Guru einen Befehl vorschlagen kann, um System-Post-Bearbeitungsprotokolle für ein bestimmtes Datum zu löschen, wäre das hilfreich, um die Protokolle zu bereinigen.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [17. Juni 2024 um 14:53 UTC](https://meta.discourse.org/t/removing-specific-staff-action-logs-using-the-console/312393/2 "2024-06-17T14:53:44Z")

</div>

Ich glaube, Sie erhalten mehr Reaktionen, wenn dies ein separates Thema ist, daher habe ich es abgetrennt. 👍

Sie werden in der `user_histories`-Tabelle gespeichert, falls Ihnen das beim Einstieg hilft?

---

<div class="post-metadata">

### Author: ![Isambard](https://avatars.discourse-cdn.com/v4/letter/i/858c86/32.png) [@Isambard](https://meta.discourse.org/u/Isambard)
#### Post date: [17. Juni 2024 um 17:11 UTC](https://meta.discourse.org/t/removing-specific-staff-action-logs-using-the-console/312393/3 "2024-06-17T17:11:15Z")

</div>

Ich dachte, es wäre so etwas wie:

```ruby
UserHistory.where("created_at > ?", date).where(and staffuser=xyz, and action=edit post).destroy_all

```

aber mit der richtigen Syntax 😛

---

<div class="post-metadata">

### Author: ![Isambard](https://avatars.discourse-cdn.com/v4/letter/i/858c86/32.png) [@Isambard](https://meta.discourse.org/u/Isambard)
#### Post date: [17. Juni 2024 um 17:17 UTC](https://meta.discourse.org/t/removing-specific-staff-action-logs-using-the-console/312393/4 "2024-06-17T17:17:34Z")

</div>

> [@JammyDodger](#):
>
> Sie werden in der `user_histories`-Tabelle gespeichert, falls Ihnen das hilft, damit anzufangen?

Wenn es nur in der Tabelle ist, ist es wahrscheinlich einfacher, sie direkt aus Postgres zu löschen.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [17. Juni 2024 um 17:17 UTC](https://meta.discourse.org/t/removing-specific-staff-action-logs-using-the-console/312393/5 "2024-06-17T17:17:47Z")

</div>

Aus dem Gedächtnis ist es:

```plaintext
UserHistory.where(bla,bla,bla)

```

> [@Introduce a way to also permanently delete the sensitive info from the staff logs](https://meta.discourse.org/t/introduce-a-way-to-also-permanently-delete-the-sensitive-info-from-the-staff-logs/292546/2?u=jammydodger):
>
> I don’t believe there is a way currently to do this from the UI. I think you would be able to delete the staff action itself through the rails console if you have access. You can find the id for the staff action either by checking the staff logs json (/admin/logs/staff\_action\_logs.json) or using a [data explorer](https://meta.discourse.org/t/32566) query to give you a list to pick it from: SELECT \* FROM user\_histories WHERE action = 17 --action code for 'delete post' ORDER BY created\_at DESC And then using that id in the rails co…

Obwohl es einige andere Teile in [Administrative Bulk Operations](https://meta.discourse.org/t/administrative-bulk-operations/118349) gibt, die Ihnen helfen könnten, das bla bla bla auszufüllen.

(Ich bin gerade nicht an meinem Computer)
