29963

Couchdb Logging

Question:

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.

<blockquote>

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

</blockquote>

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.

Answer1:

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.

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.

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.

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".

See: <a href="http://docs.couchdb.org/en/latest/config/logging.html" rel="nofollow">3.6.2 Per module logging</a>

Recommend

  • Getting zero results in search using elastic4s
  • Setting src to Base64-encoded image with Javascript is failing
  • NSMutableArray instance used in a block
  • Java : How to tint this PNG programmatically?
  • XOR with Neural Networks (Matlab)
  • pymongo replication secondary readreference not work
  • New Firebase failed: First argument must be a valid firebase URL and the path can't contain “.”
  • JSON encode and decode on PHP
  • Building Qt project for C++11 standard
  • HttpListener.IsSupported is false on XP SP3
  • Dynamically switching connect in Modelica
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • Redux Form - Not able to type anything in input
  • jQuery ready not fired after rails link_to is clicked
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • Meteor: Do Something On Email Verification Confirmation
  • Cannot resolve symbol 'MyApi'
  • How to rebase a series of branches?
  • How to get address from latitude and longitude android google map v2 [duplicate]
  • How would I use PHP exceptions to define a redirect?
  • how to add data labels for bar graph in matlab
  • Python: how to group similar lists together in a list of lists?
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • Free memory of cv::Mat loaded using FileStorage API
  • using HTMLImports.whenReady not working in chrome
  • Trying to get generic when generic is not available
  • Getting Messege Twice Using IMvxMessenger
  • Change div Background jquery
  • How to get Windows thread pool to call class member function?
  • Bitwise OR returns boolean when one of operands is nil
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal