Exporting content packs locally via cli

Hello,

I want to export all content packs locally to graylog and then sync them to a backup server and chef whole procedure, could anyone provide tips how to export content packs from MongoDB via cli? :pray:

Which version of graylog do you use? If I were you I would use API to download content packs.

1 Like

Thanks for the tip! GL version - 4.0.5

I find mongoexport command quite convenient in this case, for example:

mongoexport -d graylog -c inputs -o /home/inputs.json
2021-04-07T07:19:07.991+0000	connected to: mongodb://localhost/
2021-04-07T07:19:07.996+0000	exported 2 records

If you want to export all revisions of all content packs use API:
/api/system/content_packs

If you want to export only latest revision of all content packs use API:
/api/system/content_packs/latest

If you want to export only specific revision of one content pack use API:
/api/system/content_packs/CONTENT_PACK_ID/CONTENT_PACK_REVISION/download

https://docs.graylog.org/en/4.0/pages/configuration/rest_api.html

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.