由于应用程序需求,我有一个可从外部访问的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日志记录
发布评论