<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>15. Event Logging &mdash; Metacat 2.19.0 documentation</title>
    <link rel="stylesheet" href="_static/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="_static/font-awesome/css/font-awesome.min.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/metacatui.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '2.19.0',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="Metacat 2.19.0 documentation" href="index.html" />
    <link rel="prev" title="14. OAI Protocol for Metadata Harvesting" href="oaipmh.html" />
    <link rel="next" title="16. Enabling Web Searches: Sitemaps" href="sitemaps.html" /> 
  </head>
  <body>
  <div id="metacatDocs">
	  <div class="banner">
	      <a href="index.html"><img class="logo" src="_static/metacat-logo-white.png" /></a>
	      <a href="index.html"><h1 class="title">Metacat: Metadata and Data Management Server</h1></a>
	      <img class="logo-right" src="_static/nceas-logo-white.png" />
	  </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right">
        <span id="searchbox" style="display: none;">
            <form class="search" action="search.html" method="get">
              <input type="text" name="q" size="18" />
              <input type="submit" value="Go" class="icon-search"/>
              <input type="hidden" name="check_keywords" value="yes" />
              <input type="hidden" name="area" value="default" />
            </form>
        </span>
        </li>
        <script type="text/javascript">$('#searchbox').show(0);</script>
        <li class="right">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a>
           </li>
        <li class="right">
          <a href="sitemaps.html" title="16. Enabling Web Searches: Sitemaps"
             accesskey="N">next</a>
           </li>
        <li class="right">
          <a href="oaipmh.html" title="14. OAI Protocol for Metadata Harvesting"
             accesskey="P">previous</a>
           </li>
        <li class="breadcrumb first"><a href="index.html">Metacat 2.19.0 documentation</a> &raquo;</li> 
      </ul>
      
    </div>

	
    <div class="document">
     	 <div class="documentwrapper">
	        <div class="bodywrapper">
	          <div class="body">
	            
  <div class="section" id="event-logging">
<h1>15. Event Logging<a class="headerlink" href="#event-logging" title="Permalink to this headline">¶</a></h1>
<p>Metacat keeps an internal log of events (such as insertions, updates, deletes,
and reads) that can be accessed with the getlog action. Using the getlog action,
event reports can be output from Metacat in XML format, and/or customized to
include only certain events: events from a particular IP address, user, event
type, or that occurred after a specified start date or before an end date.</p>
<p>The following URL is used to return the basic log- an XML-formatted log of all
events since the log was initiated:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>http://some.metacat.host/context/metacat?action=getlog
</pre></div>
</div>
<p>Note that you must be logged in to Metacat using the HTTP interface or you
will get an error message. For more information about logging in, please see
Logging In with the HTTP Interface.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>&lt;!-- Example of XML Log --&gt;
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;log&gt;
&lt;logEntry&gt;&lt;entryid&gt;44&lt;/entryid&gt;&lt;ipAddress&gt;34.237.20.142&lt;/ipAddress&gt;&lt;principal&gt;uid=jones,
o=NCEAS,dc=ecoinformatics,dc=org&lt;/principal&gt;&lt;docid&gt;esa.2.1&lt;/docid&gt;&lt;event&gt;insert&lt;/event&gt;
&lt;dateLogged&gt;2004-09-08 19:08:18.16&lt;/dateLogged&gt;&lt;/logEntry&gt;
&lt;logEntry&gt;&lt;entryid&gt;47&lt;/entryid&gt;&lt;ipAddress&gt;34.237.20.142&lt;/ipAddress&gt;&lt;principal&gt;uid=jones,o=NCEAS,
dc=ecoinformatics,dc=org&lt;/principal&gt;&lt;docid&gt;esa.3.1&lt;/docid&gt;&lt;event&gt;insert&lt;/event&gt;&lt;dateLogged&gt;2004-
09-14 19:50:40.61&lt;/dateLogged&gt;&lt;/logEntry&gt;
&lt;/log&gt;
</pre></div>
</div>
<p>The basic log can be quite extensive. To subset the report, restrict the
matching events using parameters. Query parameters can be combined to further
restrict the report.</p>
<table border="1" class="docutils">
<colgroup>
<col width="17%" />
<col width="83%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Parameter</th>
<th class="head">Description and Values</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>ipAddress</td>
<td>Restrict the report to this IP Address (repeatable)</td>
</tr>
<tr class="row-odd"><td>principal</td>
<td>Restrict the report to this user (repeatable)</td>
</tr>
<tr class="row-even"><td>docid</td>
<td>Restrict the report to this docid (repeatable)</td>
</tr>
<tr class="row-odd"><td>event</td>
<td>Restrict the report to this event type (repeatable)
Values: insert, update, delete, read</td>
</tr>
<tr class="row-even"><td>start</td>
<td>Restrict the report to events after this date
Value: YYYY-MM-DD+hh:mm:ss</td>
</tr>
<tr class="row-odd"><td>end</td>
<td>Restrict the report to events before this date.
Value: YYYY-MM-DD+hh:mm:ss</td>
</tr>
</tbody>
</table>
<p>To view only the ‘read’ events, use a URL like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>http://some.metacat.host/context/metacat?action=getlog&amp;event=read
</pre></div>
</div>
<p>To view only the events for a particular IP address, use a URL like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>http://some.metacat.host/context/metacat?action=getlog&amp;ipaddress=107.9.1.31
</pre></div>
</div>
<p>To view only the events for a given user, use a URL like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>http://some.metacat.host/context/metacat?action=getlog&amp;principal=uid=johndoe,o=NCEAS,dc=ecoinformatics,dc=org
</pre></div>
</div>
<p>To view only the events for a particular document, use a URL like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>http://some.metacat.host/context/metacat?action=getlog&amp;docid=knb.5.1
</pre></div>
</div>
<p>To view only the events after a given date, use a URL like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>http://some.metacat.host/context/metacat?action=getlog&amp;start=2004-09-15+12:00:00
</pre></div>
</div>
<p>To view only the events before a given date, use a URL like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>http://some.metacat.host/context/metacat?action=getlog&amp;end=2004-09-15+12:00:00
</pre></div>
</div>
<p>To view the ‘insert’ events for September 2004 (i.e., to combine parameters) use a URL like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>http://some.metacat.host/context/metacat?action=getlog&amp;event=insert&amp;start=2004-09-01+12:00:00&amp;end=2004-09-30+23:59:59
</pre></div>
</div>
</div>


	          </div>
	        </div>
      	</div>

	
	      <div class="clearer"></div>
	    </div>
	    <div class="footer">
	    	<div class="footerNav">
				
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right">
        <span id="searchbox" style="display: none;">
            <form class="search" action="search.html" method="get">
              <input type="text" name="q" size="18" />
              <input type="submit" value="Go" class="icon-search"/>
              <input type="hidden" name="check_keywords" value="yes" />
              <input type="hidden" name="area" value="default" />
            </form>
        </span>
        </li>
        <script type="text/javascript">$('#searchbox').show(0);</script>
        <li class="right">
          <a href="genindex.html" title="General Index"
             >index</a>
           </li>
        <li class="right">
          <a href="sitemaps.html" title="16. Enabling Web Searches: Sitemaps"
             >next</a>
           </li>
        <li class="right">
          <a href="oaipmh.html" title="14. OAI Protocol for Metadata Harvesting"
             >previous</a>
           </li>
        <li class="breadcrumb first"><a href="index.html">Metacat 2.19.0 documentation</a> &raquo;</li> 
      </ul>
      
    </div>
			</div>
	    	<div class="small-print">
			      &copy; Copyright 2012, Regents of the University of California.
			      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.6.7.
			</div>
	    </div>
	</div>
  </body>
</html>