Last active
December 21, 2023 07:00
-
-
Save jameshy/d3fdbf645e224ac1df9678cbf77afc09 to your computer and use it in GitHub Desktop.
Remove all systems from papertrail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s -H "X-Papertrail-Token: API-TOKEN-HERE" https://papertrailapp.com/api/v1/systems.json | jq '.[] .name' | xargs -I {} -d '\n' sh -c 'papertrail-remove-system -s {}; echo deleted {}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I installed fluentd/papertrail on a cluster that had hundreds of pods running. Each pod created a system on papertrail, however my intention was to log only a specific namespace. Manually deleting each one of the systems on papertrail is an absolute pain. I took the above script and edited to make it work with DELETE requests to papertrail. I am using
FLUENT_HOSTNAME
as a key to get which specific logs I want to delete (we had some other logs that we want to keep). Leaving this here in case someone else stumbles upon the same kind of issue: