Couchdb日志记录 [英] Couchdb Logging

查看:164
本文介绍了Couchdb日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于应用程序需求,我有一个可从外部访问的CouchDB实例.我想看看哪些IP地址正在尝试对我的数据库进行身份验证.通过检查couchdb.log文件,我可以看到失败的身份验证尝试.它们看起来与此类似.

Due to application requirements, I have an externally accessible CouchDB instance. I would like to see what IP addresses are attempting to authenticate with my database. By checking the couchdb.log file, I can see failed authentication attempts. They look similar to this.

[2014年9月29日星期一13:43:32 GMT] [信息] [< 0.28472.7>] 127.0.0.1--GET /offline_master/401

[Mon, 29 Sep 2014 13:43:32 GMT] [info] [<0.28472.7>] 127.0.0.1 - - GET /offline_master/ 401

但是,无论我从哪里连接,似乎记录的IP地址始终是127.0.0.1.我误会了它的工作原理吗?我真的很想看到尝试连接的IP地址.

However, no matter where I connect from, it seems that the IP address that is logged is always 127.0.0.1. Am I mis-understanding how this works? I would really like to see the IP address that is attempting to connect.

推荐答案

127.0.0.1是长沙发数据库的绑定地址.之所以在这里,是因为您可以根据需要使用的主机名,将ouchdb设置为不同的响应方式.

The 127.0.0.1 is the address couchDB is bound to. It's there because you can set up couchdb to respond differently depending on what host name is being used.

获取客户端ip地址的唯一方法是将日志记录级别设置为调试".您可以在futon的配置页面中执行此操作.

The only way to get the client ip address is by turning the logging level to "debug". You can do this in the configuration page in futon.

您将获得这样的记录(客户端IP位于第一行):

You get records like this (client IP is on 1st line):

[Tue, 30 Sep 2014 00:14:27 GMT] [debug] [<0.451.4>] 'GET' / {1,1} from "192.168.1.52"
Headers: [{'Accept',"*/*"},
          {'Host',"localhost:5984"},
          {'User-Agent',"curl/7.30.0"}]
[Tue, 30 Sep 2014 00:14:27 GMT] [debug] [<0.451.4>] OAuth Params: []
[Tue, 30 Sep 2014 00:14:27 GMT] [info] [<0.451.4>] 127.0.0.1 - - GET / 200

对此要小心.调试日志非常冗长.很快就可以装满硬盘.

Be careful with this. The debug logs are extremely verbose. It doesn't take long to fill up a hard drive.

可以按模块设置日志级别.您需要设置的模块是couch_httpd.将其余的默认设置为错误"或致命".

It is possible to set log levels by module. The module you need to set is couch_httpd. Set the default for the rest to "error" or "fatal".

请参阅: 3.6.2每个模块的日志记录

这篇关于Couchdb日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆