Hello,
I haven't tried rules yet, but I perhaps it helps, if you take a look at
this command, wich works for me giving users new permissions:
curl --user user:password -0 -XPUT
http://localhost:12900/users/<username>/permissions -H "Content-Type:
application/json" -d '{"permissions":'$NEWPERMISSIONS'}'
Didn't you any logs within graylog-server.log? During my scripting I saw
helpful hints, e.g. what parameters are really needed/recognized. I think
it would be really helpful to see some examples within the API-Browser ;-)
Bye, Cornelius
Am Donnerstag, 27. Februar 2014 00:13:57 UTC+1 schrieb schlag:
>
> Hi, I'm new to graylog2, just installed graylog2-server & web-interface
> 0.20.1, ES 0.90.10, Mongodb 2.0.6, on Debian Wheezy/7.4. Congrats on the
> new release!
>
> I have some ~200 inverted stream rules that I want to add via the api, but
> am getting 400 error codes in the api-browser, and nothing on the command
> line using curl (though with an exit code of 0) eg:
>
> curl -XPOST
> http://user:[email protected]:12900/streams/530cf55ce4b0e7ba65dadb91/rules-d
> '[{"id":"530cf5a9e4b0e7ba65dadbe3","field":"message","value":"some regex
> expression","stream_id":"530cf55ce4b0e7ba65dadb91","type":2,"inverted":true}]'
>
> The creds I'm using belong to a graylog2 admin account, which I've used to
> make other api updates successfully.
>
> If I query for stream rules, I get this (it's a simple, non-inverted rule
> that I added via the ui):
>
> curl -XGET
> http://user:[email protected]:12900/streams/530cf55ce4b0e7ba65dadb91/rules
> {"total":1,"stream_rules":[{"id":"530e5013e4b0e7ba65dc47b9","field":"message","value":"invoked
>
> oom-killer","stream_id":"530cf55ce4b0e7ba65dadb91","type":2,"inverted":false}]}
>
> I also tried this:
>
> curl -XPOST
> http://user:[email protected]:12900/streams/530cf55ce4b0e7ba65dadb91/rules-d
> '{"total":1,"stream_rules":[{"id":"530e5013e4b0e7ba65dc47b9","field":"message","value":"some
>
> regex
> expression","stream_id":"530cf55ce4b0e7ba65dadb91","type":2,"inverted":true}]}'
>
>
> Any ideas on what I might be missing? I've tried different json strings
> to no avail, and I'm assuming that is where I'm going wrong. I'm not
> seeing anything in the graylog2-server or web-interface logs. I'm trying
> to avoid adding them through the ui, which would be painful to do, one at a
> time.
>
> Thanks in advance!
>
--
You received this message because you are subscribed to the Google Groups
"graylog2" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.