Inputs.http json format getting parse error

telegraf

#1

hi,
I’m using the latest telegraf docker image and enabling the inputs.http to call a single url
the response is in json format so i chose date_format = “json”
I tried a combination of adding the json query and fields, tags etc but
the telegraf metric parser error. The http response is this json

[
    {
        "user_id": "usr_BJeB2mHGsQ",
        "layer": 1,
        "frequency": 1,
        "createdAt": "2018-10-15T16:43:24.977Z",
        "dow": [
            0,
            1,
            2,
            3,
            4,
            5,
            6
        ],
        "end": 1539673200,
        "exceptions": [],
        "id": "evt_HkSrhQrMiX",
        "schedule_id": "skd_S1XH2QrGiQ",
        "repeat": true,
        "start": 1539586800,
        "sid": "acc_HkH2QHGi7"
    }
]

here is the error
E! [inputs.http]: Error in plugin: [url=https://url_redacted]: metric parse error: expected tag at offset 38: “[{“user_id”:“usr_BJeB2mHGsQ”,“layer”:1,“frequency”:1,“createdAt”:“2018-10-15T16:43:24.977Z”,“dow”:[0,1,2,3,4,5,6],“end”:1539673200,“exceptions”:[],“id”:“evt_HkSrhQrMiX”,“schedule_id”:“skd_S1XH2QrGiQ”,“repeat”:true,“start”:1539586800,“sid”:“acc_HkH2QHGi7”}]”

Is there something in the telegraf config that’s required to over come the parsing issue?
I tried some of the troubleshooting steps found in the github issues like this https://github.com/influxdata/telegraf/issues/4650
but couldn’t get beyond the error i’m getting.

Thanks,


#2

Update: error is gone when I added a tag_key entry for each response, will play around with json query and fields settings to grab only the parts i need
thanks