Metacat getlog action |
Back | Home | Next |
The Metacat servlet provides an 'action' for retrieving a log of the events that have occurred, including document insertions, updates, deletes, and reads. This allows a simple reporting facility where event reports can be output in XML format. The report can be subset to only include events from a particular IP address, user, event type, after a start date, or before an end date.
The basic log can be viewed using the getlog
servlet
action, as in the following URL:
http://some.metacat.host/context/metacat?action=getlog
This will return an XML formatted log of all events since the log was initiated, which can be quite extensive. To subset the report, provide parameters to restrict the set of matching events:
insert
update
delete
read
YYYY-MM-DD+hh:mm:ss
YYYY-MM-DD+hh:mm:ss
Some example queries follow. To view only the 'read' events, use a url like:
http://some.metacat.host/context/metacat?action=getlog&event=read
To view only the events for a particular IP address, use a url like:
http://some.metacat.host/context/metacat?action=getlog&ipaddress=107.9.1.31
To view only the events for a given user, use a url like:
http://some.metacat.host/context/metacat?action=getlog&principal=uid=johndoe,o=NCEAS,dc=ecoinformatics,dc=org
To view only the events for a particular document, use a url like:
http://some.metacat.host/context/metacat?action=getlog&docid=knb.5.1
To view only the events after a given date, use a url like:
http://some.metacat.host/context/metacat?action=getlog&start=2004-09-15+12:00:00
To view only the events before a given date, use a url like:
http://some.metacat.host/context/metacat?action=getlog&end=2004-09-15+12:00:00
Query parameters can be combined, so to view the 'insert' events for September 2004 use a url like:
http://some.metacat.host/context/metacat?action=getlog&event=insert&start=2004-09-01+12:00:00&end=2004-09-30+23:59:59
The log is returned in XML format. Here is an example log format:
<?xml version="1.0"?> <log> <logEntry><entryid>44</entryid><ipAddress>34.237.20.142</ipAddress><principal>uid=jones,o=NCEAS,dc=ecoinformatics,dc=org</principal><docid>esa.2.1</docid><event>insert</event><dateLogged>2004-09-08 19:08:18.16</dateLogged></logEntry> <logEntry><entryid>47</entryid><ipAddress>34.237.20.142</ipAddress><principal>uid=jones,o=NCEAS,dc=ecoinformatics,dc=org</principal><docid>esa.3.1</docid><event>insert</event><dateLogged>2004-09-14 19:50:40.61</dateLogged></logEntry> </log>