How to install content pack using curl/ command?

Hi,
Im trying to install my custom content pack to graylog3 using curl, but no luck yet. I can able to upload and install using web ui.
Is there any way install it using curl ?

Regards

he @jamesarems

you need to place the plugin in your configured plugin folder. The default location depend on your way of installing.

http://docs.graylog.org/en/3.1/pages/configuration/file_location.html

Also the way to install curl depends on the operation system you have. As you did not give that information we can’t help with that.

Hi @jan,
Thanks for the reply.
Im using CentOS 7, latest release.

Hello @jamesarems

If I understand correctly, you want to install content pack from json file using curl, not plugin as mentioned @jan.

If so, try to use this steps:

  1. First upload content pack to graylog from file:
  • If you use user name and password use command:
    curl -i -X POST -u username:password -H 'Content-Type: application/json' -H 'X-Requested-By: cli' 'http://graylog.domain.com:9000/api/system/content_packs' -d @file.json

  • If you use token use this command:
    curl -i -X POST -u your_token:token -H 'Content-Type: application/json' -H 'X-Requested-By: cli' 'http://graylog.domain.com:9000/api/system/content_packs' -d @file.json

  1. Second install uploaded content pack:
  • If you use user name and password use this command:
    curl -i -X POST -u username:password -H 'Content-Type: application/json' -H 'X-Requested-By: cli' 'http://graylog.domain.com:9000/api/system/content_packs/52436b10-26f9-445d-b3bb-6f1f3c1ceafb/1/installations' -d '{"parameters": {},"comment": ""}'

  • If you use token use this command:
    curl -i -X POST -u your_token:token -H 'Content-Type: application/json' -H 'X-Requested-By: cli' 'http://graylog.domain.com:9000/api/system/content_packs/52436b10-26f9-445d-b3bb-6f1f3c1ceafb/1/installations' -d '{"parameters": {},"comment": ""}'

Replace 52436b10-26f9-445d-b3bb-6f1f3c1ceafb with your content pack id.
Replace username with your username
Replace password with your password
Replace your_token with token, if you use it
Replace graylog.domain.com with your URL
Replace file.json with your content pack file

Check also how to use Rest API:
https://docs.graylog.org/en/3.1/pages/configuration/rest_api.html#graylog-rest-api