2
我正在使用monolog logstashFormater創建我的日誌,而不是將其插入到我的logstash中。logstash和monolog格式化程序
下面是獨白創建日誌的例子:
{"@timestamp":"2014-12-08T09:07:54.810335+00:00","@source":"devServer","@fields":{"channel":"orderLogger","level":100,"ctxt_site":"roulette","ctxt_country":"uk","ctxt_type":"virtual"},"@message":"order","@tags":["orderLogger"],"@type":"core"}
它是建立良好的logstash, 現在我加載logstash與此配置
input {
stdin { }
}
output {
stdout { codec => rubydebug }
}
,但現在我試着粘貼從monolog創建的日誌,我得到這個:
{
"message" => "{\"@timestamp\":\"2014-12-08T09:07:54.810335+00:00\",\"@source\":\"devServer\",\"@fields\":{\"channel\":\"orderLogger\",\"level\":100,\"ctxt_site\":\"roulette\",\"ctxt_country\":\"uk\",\"ctxt_type\":\"virtual\"},\"@message\":\"order\",\"@tags\":[\"orderLogger\"],\"@type\":\"core\"}",
"@version" => "1",
"@timestamp" => "2014-12-08T09:08:24.800Z",
"host" => "logstash"
}
所以你c看,logstash沒有正確解析它,它只是將所有的字符串放在消息中。
任何想法?
如果有人今天碰到這個問題:[monolog現在默認使用V1格式](https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/LogstashFormatter.php) – guessimtoolate 2017-08-02 08:47:56