问题描述
我已经安装了oink gem来监控我的rails应用程序的内存使用情况。
为了看到oink报告,我需要在终端中运行这个命令:
oink --threshold = 75 / log / *
当我在我的机器上运行它时,它显示了开发环境的报告。
事情是,我对查看生产环境报告感兴趣。
我的应用程序托管在heroku上,有没有一种方法可以为heroku的生产环境运行oink的终端命令?
谢谢 $ b $
您必须将您的log_level更改为info为了显示oink日志:
heroku config:add LOG_LEVEL = info
使用自定义stdout记录器将oink中间件添加到production.rb中
config.middleware.use(Oink :: Middleware,:logger => Hodel3000CompliantLogger.new(STDOUT))
如果您想解析日志,请将它们放在本地文件中,然后删除heroku的前缀并仅筛选oink行。
heroku logs --tail> log / production.log
cat log / production.log |切-c 46- | grep'Oink \ | Memory \\'| Instantiation'> log / production-oink.log
然后在新本地日志中运行oink
oink --threshold = 0 log / production-oink.log
您也可以从logentries或paperclip下载日志
I've installed oink gem for monitoring the memory usage of my rails application.In order to see oink report I need to run this command in the terminal:
oink --threshold=75 /log/*
When I run it on my machine it shows the report for the development environment. The thing is that I'm more interested on seeing the report for my production environment.My app is hosted on heroku, is there a way I could run oink's terminal commands for the heroku's production environment?
Thanks
I got oink working on heroku doing this:
You have to change your log_level to info for the oink logs to show up:
heroku config:add LOG_LEVEL=info
Add oink middleware to production.rb with a custom stdout logger
config.middleware.use( Oink::Middleware, :logger => Hodel3000CompliantLogger.new(STDOUT))
When you want to parse your logs, tail them to a local file, then remove heroku's prefix and filter to only the oink lines.
heroku logs --tail > log/production.log
cat log/production.log | cut -c 46- | grep 'Oink\|Memory\|Instantiation' > log/production-oink.log
Then run oink on your new local log
oink --threshold=0 log/production-oink.log
You could also download logs from logentries or paperclip
这篇关于与heroku一起使用oink宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!