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:
- Easily get a list of comments from all my users locally and across the 'verse?
- 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?)
Do you have an example of a query I could use? I'm a bit rusty with databases :) with an example I can get chatgpt to build me something better
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.