juno/logglier — pull request #1 by juno (2011-11-08 10:13:59+00:00)
Title: Explicitly set default content type header.

Recently, Loggly seems to changed it's Input API behavior.

POST to Loggly Input API without Content-Type header.

$ curl -X POST \
-d "HTTP POST without Content-Type header" \
https://logs.loggly.com/inputs/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
$ curl -u user:password "https://subdomain.loggly.com/api/search?q=without"
{
"data": [
{
"timestamp": "2011-11-08T09:59:56.999Z",
"isjson": false,
"ip": "10.0.0.1",
"inputname": "default",
"inputid": "5457",
"text": "{\"HTTP POST without Content-Type header\":\"\"}"
}
],
...
}

`data[0].text` is stored as a JSON string.

Same with Content-Type: text/plain header.

$ curl -X POST \
-H "Content-Type: text/plain" \
-d "HTTP POST with Content-Type: text/plain header" \
https://logs.loggly.com/inputs/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
$ curl -i -u user:password "https://subdomain.loggly.com/api/search?q=plain"
{
"data": [
{
"timestamp": "2011-11-08T10:06:49.472Z",
"isjson": false,
"ip": "10.0.0.1",
"inputname": "default",
"inputid": "5457",
"text": "HTTP POST with Content-Type header"
}
],
...
}

`data[0].text` is stored as a plain text.