標籤: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匯入資料