定制神记录?
上帝帮助我们在 Rails 盒子上运行一些服务(特别是 Nginx 和 MySQLd),但我希望在它真正投入使用时获得更多细节。到目前为止,使用 w.log = /var/log/god/mysql.log
(例如)设置监视日志文件可以让我们得到很多像这样的东西:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
* Starting MySQL database server mysqld
...done.
...这足够酷了以它的方式,因为它告诉我服务器宕机了,上帝重新启动了它,但我希望得到诸如时间戳之类的东西,也许还有一些其他细节。 (服务器负载、内存状态或其他可以帮助我诊断 MySQLd 一开始就宕机的原因。)
上帝支持在触发此类事件时向日志文件添加额外的信息吗?
God has helped us keep a few services running on a Rails box (Nginx and MySQLd, specifically) but I'm hoping to get some more details when it actually swings into action. So far, setting the watch log file using w.log = /var/log/god/mysql.log
(for example) gets us a lot of stuff like this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
* Starting MySQL database server mysqld
...done.
...which is cool enough in its way, because it tells me that the server went down and God restarted it, but I'm hoping for something like a timestamp and maybe some other details. (Server load, memory status, or something else to help me diagnose why MySQLd went down to begin with.)
Does God support adding extra information to logfiles when events like this are triggered?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
至少你应该能够通过用类似以下内容启动上帝来获得时间戳:
god -Dc config/sst.god --log-level debug
但据我所知应该已经有是 w.log 文件中日志消息之前的时间戳。就日志文件自定义而言,它看起来像是 问题已经持续了几年(简短的回答:这不是一个选择)。
At the very least you should be able to get a timestamp by starting god with something like:
god -Dc config/sst.god --log-level debug
but as far as I can tell there should already be timestamps preceding log messages in your w.log file. As far as logfile customization goes, it looks like it's been an issue for a few years (short answer: it's not an option).