Hi,
the right syntax is to use single quotes, but this is problematic with
curl because the json string itself is usually put in single quotes.
So your call looks like this:
curl -X POST -d '{some json}'
now you can't simply put another single quote in the json string like
-d '{some' json}' that would terminate the string at that point.
One way is to use unicode for that. You can do it like:
curl -X POST -d '{some \u0027 json}'
A complete call to create e.g. an collector input looks then like this:
curl -v -u admin:admin -H "Content-Type: application/json" -X POST -d
'{"backend": "filebeat","type": "file","name":
"file-input","properties": {"paths":
"[\u0027/var/log/*.log\u0027]","scan_frequency": "10s","encoding":
"plain","ignore_older": "0","document_type": "log","exclude_lines":
"[]","include_lines": "[]","tail_files": true},"forward_to":
"5846e531adca4c0315bc6e8b"}'
http://192.168.1.109:9000/api/plugins/org.graylog.plugins.collector/configurations/5846e51eadca4c0315bc6e77/inputs
Cheers,
Marius
On 6 December 2016 at 00:06, Evgueni Gordienko wrote:
> Hi,
>
> When I curl with GET method on collector config info I get
> "paths" : "[\"/var/log/*.log\",\"/var/log/messages\",\"/var/log/secure\"]"
>
> So which form is correct in POST for configuration:
>
> "properties": {
> "paths": "['/var/log/*.log','/var/log/messages']",
>
> or
>
> "properties": {
> "paths":
> "[\"/var/log/*.log\",\"/var/log/messages\",\"/var/log/secure\"]",
>
> Thanks,
> Evgueni
>
> --
> You received this message because you are subscribed to the Google Groups
> "Graylog Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to graylog2+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/graylog2/752950d1-c531-49c4-9aa9-d6853e64d8fc%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Developer
Tel.: +49 (0)40 609 452 077
Fax.: +49 (0)40 609 452 078
TORCH GmbH - A Graylog Company
Poolstraße 21
20335 Hamburg
Germany
https://www.graylog.com
Commercial Reg. (Registergericht): Amtsgericht Hamburg, HRB 125175
Geschäftsführer: Lennart Koopmann (CEO)
--
You received this message because you are subscribed to the Google Groups
"Graylog Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to graylog2+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/graylog2/CAMqbBbK3UPBUtHRzrKbekUMXQ-%3D1ZV9WKi%3DMh1K7f8GengnatQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.