Project

General

Profile

metacat / docs / user / metacat / source / event-logging.rst @ 8265

1
Event Logging
2
=============
3

    
4
Metacat keeps an internal log of events (such as insertions, updates, deletes, 
5
and reads) that can be accessed with the getlog action. Using the getlog action, 
6
event reports can be output from Metacat in XML format, and/or customized to 
7
include only certain events: events from a particular IP address, user, event 
8
type, or that occurred after a specified start date or before an end date. 
9

    
10
The following URL is used to return the basic log- an XML-formatted log of all 
11
events since the log was initiated::
12

    
13
  http://some.metacat.host/context/metacat?action=getlog 
14

    
15
Note that you must be logged in to Metacat using the HTTP interface or you 
16
will get an error message. For more information about logging in, please see 
17
Logging In with the HTTP Interface.
18

    
19
::
20

    
21
  <!-- Example of XML Log -->
22
  <?xml version="1.0"?>
23
  <log>
24
  <logEntry><entryid>44</entryid><ipAddress>34.237.20.142</ipAddress><principal>uid=jones,
25
  o=NCEAS,dc=ecoinformatics,dc=org</principal><docid>esa.2.1</docid><event>insert</event>
26
  <dateLogged>2004-09-08 19:08:18.16</dateLogged></logEntry>
27
  <logEntry><entryid>47</entryid><ipAddress>34.237.20.142</ipAddress><principal>uid=jones,o=NCEAS,
28
  dc=ecoinformatics,dc=org</principal><docid>esa.3.1</docid><event>insert</event><dateLogged>2004-
29
  09-14 19:50:40.61</dateLogged></logEntry>
30
  </log>
31

    
32
The basic log can be quite extensive. To subset the report, restrict the 
33
matching events using parameters. Query parameters can be combined to further 
34
restrict the report.
35

    
36
+-----------+-----------------------------------------------------+
37
| Parameter | Description and Values                              |
38
+===========+=====================================================+
39
| ipAddress | Restrict the report to this IP Address (repeatable) |
40
+-----------+-----------------------------------------------------+
41
| principal | Restrict the report to this user (repeatable)       |
42
+-----------+-----------------------------------------------------+
43
| docid     | Restrict the report to this docid (repeatable)      |
44
+-----------+-----------------------------------------------------+
45
| event     | Restrict the report to this event type (repeatable) |
46
|           | Values: insert, update, delete, read                |
47
+-----------+-----------------------------------------------------+
48
| start     | Restrict the report to events after this date       |
49
|           | Value: YYYY-MM-DD+hh:mm:ss                          |
50
+-----------+-----------------------------------------------------+
51
| end       | Restrict the report to events before this date.     |
52
|           | Value: YYYY-MM-DD+hh:mm:ss                          |
53
+-----------+-----------------------------------------------------+
54

    
55
To view only the 'read' events, use a URL like::
56

    
57
  http://some.metacat.host/context/metacat?action=getlog&event=read
58

    
59

    
60
To view only the events for a particular IP address, use a URL like::
61

    
62
  http://some.metacat.host/context/metacat?action=getlog&ipaddress=107.9.1.31
63

    
64

    
65
To view only the events for a given user, use a URL like::
66

    
67
  http://some.metacat.host/context/metacat?action=getlog&principal=uid=johndoe,o=NCEAS,dc=ecoinformatics,dc=org 
68

    
69

    
70
To view only the events for a particular document, use a URL like::
71

    
72
  http://some.metacat.host/context/metacat?action=getlog&docid=knb.5.1 
73

    
74

    
75
To view only the events after a given date, use a URL like::
76

    
77
  http://some.metacat.host/context/metacat?action=getlog&start=2004-09-15+12:00:00
78

    
79

    
80
To view only the events before a given date, use a URL like::
81

    
82
  http://some.metacat.host/context/metacat?action=getlog&end=2004-09-15+12:00:00
83

    
84

    
85
To view the 'insert' events for September 2004 (i.e., to combine parameters) use a URL like::
86

    
87
  http://some.metacat.host/context/metacat?action=getlog&event=insert&start=2004-09-01+12:00:00&end=2004-09-30+23:59:59 
88