Read and summarize your logs
Pull a window of request logs, then the same window as grouped counts, for a status page or a support reply.
get_logs reads back the same account_log documents every call to /cpi writes for you, scoped
to your own account: what was called, from where, and what came back. get_logs_counts answers a
narrower question over the same window, how many, grouped, which is cheaper than paging through
every row yourself when a support reply or a status widget only needs the shape of a period, not
its detail.
Methods
Get Logs
Queries logs of a given type within a timestamp range, with optional search, paging, and status filters.
Get Logs Counts
Returns grouped log counts by request type or response status within a timestamp range.
Walkthrough
Read a window of entries
log_type, log_date_from and log_date_to are the only declared fields, but the handler also
reads an undeclared log_search (free text over the request/response bodies and headers) and
log_status ('success' or 'failed', by HTTP status band). log_type: "account_log" scopes to
this account automatically, you never pass uid yourself.
2. Get the same window as grouped counts
get_logs_counts also needs an undeclared request_type or response_status value to pick which
grouped view it reads; sending neither is a refusal, not an empty result (see Errors). request_type
is the log's own request_type field, 'POST' for every account_log row add_account_log
writes today. The grouping key response_status builds against lives in a view definition this
repo does not carry, confirm the values your own rows group under with get_logs first rather than
guessing one.
The response
get_logs passes a Mango find result straight through, docs plus a bookmark for the next
page:
get_logs_counts passes a raw CouchDB grouped-view result through instead, rows of { key, value } where value is the count for that key. Which fields make up key is set by the view
itself, not by this handler; treat it as an opaque group id and read value for the number.