Importing .json

Description of your problem

Hi All,
I am trying to use “JSON path from HTTP API” or any other method to get API data that returns A JSON struct that has an array data similer to below:
JSON data can be access via .json file or via the HTTP API

[ {
“Role”: “Skype for Business Administrator”,
“DisplayName”: “Jonathon”,
“ObjectType”: “User”,
“AccountEnabled”: true,
“UserPrincipaName”: “”,
“PasswordPolicies”: “None”,
“HomePage”: null
},
{
“Role”: “Skype for Business Administrator”,
“DisplayName”: “Adam”,
“ObjectType”: “User”,
“AccountEnabled”: true,
“UserPrincipaName”: “”,
“PasswordPolicies”: “None”,
“HomePage”: null
}
]

Description of steps you’ve taken to attempt to solve the issue

I used the https://jsonpath.com/ to check on the JSONPath Syntax and it returns all nesesary data, but when using “JSON path from HTTP API”, i only get the first recoard.

Can someone please give me some ideas how to get .json file or .json API data into Graylog

Hello && Welcome

I’m not sure what you environment is, but here is some information for you on the JSON path from HTTP API input Perhaps these links will help.

Graylog Input

https://docs.graylog.org/en/4.1/pages/sending/json.html

Graylog API:

https://docs.graylog.org/en/4.1/pages/configuration/rest_api.html

How To Send Log Data:

https://docs.graylog.org/en/4.1/pages/sending_data.html#sending-in-log-data

Thanks for the reply.
I have seen above, and noticed this artical. Garylog and PRTG API (REST JSON)

"Basically it’s a plain RESTFul API that can return A JSON struct that has an array with a dict entry for each item. So you can have something like:

{ … , “sensors”: [{“id”: “1234”, “name”: “sensor1”, … }, { "id: “1278”, “name”: “sensor2”}, … ]}

What I want is to transform each item into a record in Graylog."

My API json output is array as above. Quetion is that can I use “JSON path from HTTP API input” to get each item into a record in Graylog?

Thanks in advance.

Hello,

I believe you can by using JSON path of data to extract
For example:

{
  "name": "Rose Kolodny",
  "phoneNumbers": [
    {
      "type": "home",
      "number": "954-555-1234"
    },
    {
      "type": "work",
      "number": "754-555-5678"
    }
  ]
}

JSON path of data to extract
$.phoneNumbers[*].number

Which should return this

[954-555-1234, 754-555-5678]

Thanks for your time gsmith, i will check it and let u know.

Cheers.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.