简体   繁体   English

如何在Logstash-logger中添加控制器名称

[英]How to add the controller name in logstash-logger

I'm using Logstash-logger . 我正在使用Logstash-logger I would like to know how to add the controller name or routes to appears automatically in the logs. 我想知道如何将控制器名称或路由添加到日志中。 Here is the default logs 这是默认日志

      #production.log  
{
        "message":"  Couldn't find template for digesting: docs/#{@doc.layout}",
        "@timestamp":"2015-10-28T22:15:05.963+00:00",
        "@version":"1",
        "severity":"ERROR",
        "host":"localhost"
       }

expected 预期

{
        "message":"  Couldn't find template for digesting: docs/#{@doc.layout}",
        "@timestamp":"2015-10-28T22:15:05.963+00:00",
        "@version":"1",
        "severity":"ERROR",
        "host":"localhost",
        "routes" : "AticlesController#index",
        #or from view
        "view": "Articles#index#_partial_name
       }

Author of LogStashLogger here. LogStashLogger的作者在这里。 I would recommend that you check out the Logstasher or Lograge gems. 我建议您查看LogstasherLograge宝石。 They both have very good support for logging information about the controller and views involved in the request. 它们都很好地支持记录有关控制器和请求中涉及的视图的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM