After the bot attacks I’ve cleaned up and implemented some additional measures thanks to some helpful users, but I’d also like to monitor the situation in case someone from my server decides to go on a spam rampage…

Is there a way to:

  1. Easily get a list of comments from all my users locally and across the 'verse?
  2. If I purge/ban these users, is there a protocol for letting other Lemmy admins know? I assume I have no power to delete things from their instances (just my copy of their instance?)
  • Salamander@mander.xyz
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    Sure! The comments that are posted from within your instance are labeled with “local = true”, even if they are posted to other instances. So the query below will dump all of the database entries for comments in your instance into a file. Assuming that you have a docker install.

    docker exec LEMMY_POSTGRES_CONTAINER_NAME psql -U POSTGRES_USER -c "select * from comment where local=true order by comment.published desc;" > all_comments.txt

    This will print to a file the comment table including all of the comments posted from within your instance, starting with the newest post. It is possible to combine other queries (such as associating the creator ID with the username), and then parse the output to produce a more informative and easy-to read output. But what I have shown might be enough for you. I may be able to help you if you need a more specific query.