splunk 通過rest http匯入資料

來源:互聯網
上載者:User

標籤:line   web   new   enable   sans   global   aaa   his   size   

使用 HTTP Event Collector

go to Settings > Data inputs > HTTP Event Collector. Then click the Global Settings button in the upper-right corner. 然後enable設定下!

然後去add data添加http EC。

在設定裡source type選擇json。

完成後會給你產生一個token!

使用如下命令匯入資料:

curl -k https://<host>:8088/services/collector -H ‘Authorization: Splunk <token>‘ -d ‘{"sourcetype": "mysourcetype", "event":"Hello, World!"}‘ 

在上面的配置下,其中xxtest是我建立的HEC名:
curl -k  https://localhost:8088/services/collector/event  -H "Authorization: Splunk E35F7010-B2DC-4061-B2EA-2870FC8EA546" -d ‘{"event": "hello world bone this is a temp test", "sourcetype": "xxtest"}‘

 

You should now see the following response:

{"text":"Success","code":0}

然後去splunk的搜尋介面,https://localhost:8000,輸入:source=xxtest,可以看到上述資料。

 

其他注意事項:我在splunk web裡setting裡設定了ssl 為true,就是說必須使用ssl才可以訪問。可能會對上述操作由影響。

 

參考:

http://dev.splunk.com/view/event-collector/SP-CAAAE7F

https://docs.splunk.com/Documentation/Splunk/6.5.1/Data/UsetheHTTPEventCollector

 

splunk 通過rest http匯入資料

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.