2016-06-08 46 views
0

我正在嘗試使用winston-splunk在splunk中顯示日誌。 不知怎的,我無法看到日誌。 我完全陌生的雙方的Splunk和溫斯頓,這裏是我的代碼:Splunk和Winston for Nodejs

var splunk = require('winston-splunk').splunk; 
    var transport = new (splunk)({splunkHostname: 'localhost'}); 
    transport.log("error","er","This is the error message",function(err,res){ 
     console.log(err+" "+res); 
    }) 

我怎樣才能顯示在Splunk的此消息?我還創建了一個http事件收集器,用於令牌,但無法使用。 有人能指導我正確的方式嗎? 如何配置和設置我的環境,如果有任何代碼示例,它將非常有幫助。 謝謝全部

回答

0

winston-splunk實際上不支持HTTP事件收集器 - 只有UDP。您需要使用winston-splunk-httplogger。你可以在the GitHub repo上看到一個例子。