couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Woodhead <>
Subject Count since
Date Wed, 25 May 2011 17:17:15 GMT
Hi folks,

I was wondering if someone could help me with a view.

We're storing some Apache logs in CouchDB and I want to report on
requests by IP address in the last n of time. The ultimate goal is to
key on IP address, returning a count of requests within the last day.

I've got the count by IP working fine with the following map/reduce:

function(keys, values, rereduce)
  return sum(values);

Can anyone guide me as to how to emit only records where the date/time
(stored as REQUEST_TIME in seconds since epoch), e.g. 1306343401.
Effectively I want the map to emit records where that field is greater
than the current timestamp - n seconds.

Any pointers greatly appreciated.

***** Email confidentiality notice *****

This message is private and confidential. If you have received this message in error, please
notify us and remove it from your system.

Simwood eSMS Limited is a limited company registered in England and Wales. Registered number:
03379831. Registered office: c/o HW Chartered Accountants, Keepers Lane, The Wergs, Wolverhampton,
WV6 8UA. Trading address: Falcon Drive, Cardiff Bay, Cardiff, CF10 4RU.

View raw message