简体   繁体   中英

How to add the controller name in logstash-logger

I'm using 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. I would recommend that you check out the Logstasher or Lograge gems. They both have very good support for logging information about the controller and views involved in the request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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