[英]How can I get the JSON from kibana?
從 Kibana 儀表板中,我得到了這個 JSON。 我需要在我的網站中使用“消息”(這是我的腳本的結果),我該怎么做?
注意:腳本是logstash的輸入,它被發送到elasticsearch,然后用Kibana可視化,這段代碼來自kibana中的JSON部分。
{
"_index": "test",
"_type": "doc",
"_id": "l-RRWncBMkK0B15vMizO",
"_version": 1,
"_score": null,
"_source": {
"command": "sh -c /home/ubuntu/hello.sh",
"host": "elk",
"@version": "1",
"message": "bin\nboot\ndev\netc\nhome\ninitrd.img\ninitrd.img.old\nlib\nlib64\nlost+found\nmedia\nmnt\nopt\nproc\nroot\nrun\nsbin\nsnap\nsrv\nsys\ntmp\nusr\nvar\nvmlinuz\nvmlinuz.old\n",
"@timestamp": "2021-01-31T21:20:06.716Z"
},
"fields": {
"@timestamp": [
"2021-01-31T21:20:06.716Z"
]
},
"sort": [
1612128006716
]
}
你的問題似乎不完整。 但是,我假設,您正在嘗試訪問從 Elasticsearch 到您的代碼的事件。
您可以嘗試點擊 Elasticsearch api 來獲取此 json,並訪問消息字段。 下面的例子:
**SYNTAX**
curl -XGET "<elasticsearch_ip>:<elasticsearchport(default is 9200)>/<index_name>/_search" -H 'Content-Type: application/json' -d'<query to fetch the index documents>'
**EXAMPLE**
curl -XPOST "http://localhost:9200/test/_search" -H 'Content-Type: application/json' -d'{ "query": { "match_all": {} }}'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.