Ace:JSON Interface: Difference between revisions
From Adapt
No edit summary |
No edit summary |
||
Line 86: | Line 86: | ||
* logpath - path to get events for, or set to empty to clear | * logpath - path to get events for, or set to empty to clear | ||
* collection - collection to retrieve events for, or set to 0 to clear | * collection - collection to retrieve events for, or set to 0 to clear | ||
* clear - set to 1 to reset any filters | * clear - set to 1 to reset any filters, if you do not want to cache filters, then you can supply this with every call | ||
'''Output''' | '''Output''' | ||
Line 93: | Line 93: | ||
<pre> | <pre> | ||
start - long, starting log entry | |||
count - int, number of entries asked for (actual results may be less) | |||
session - long, current session filter if any (opt) | session - long, current session filter if any (opt) | ||
collection - long, current collection filter (opt) | collection - long, current collection filter (opt) | ||
logpath - current path filter (opt) | logpath - current path filter (opt) | ||
filter - array of currently used filters, 'errors','missing','newmaster','sync' | |||
events : [ array containing log events | events : [ array containing log events | ||
id - long, numeric ID of log entry | id - long, numeric ID of log entry | ||
date - timestamp of entry | date - timestamp of entry | ||
session - long, session this entry belongs to | session - long, session this entry belongs to | ||
type - type of log entry, complete list available at [Ace:Log Messages] | type - int, type of log entry, complete list available at [Ace:Log Messages] | ||
collection - long, collection this entry is attached to (opt) | collection - long, collection this entry is attached to (opt) | ||
path - path this item is attached to | path - path this item is attached to | ||
Line 108: | Line 111: | ||
'''Example''' | '''Example''' | ||
Display default (last 20) listings | |||
URL: http://localhost:8080/ace-am/EventLog?clear=1&json=1 | |||
Output: | |||
<pre> | |||
{ | |||
"start": 0, | |||
"count": 20, | |||
"filter": [], | |||
"events": [ | |||
{ | |||
"id": 27796479, | |||
"date": "Thu Jan 08 21:03:06 EST 2009", | |||
"session": 1231448172510, | |||
"type": 5, | |||
"description": "Round: 681048", | |||
"collection": 24, | |||
"path": "/dir-49/dir-49/dir-49/file-0" | |||
}, | |||
{ | |||
"id": 27796480, | |||
"date": "Thu Jan 08 21:03:06 EST 2009", | |||
"session": 1231448172510, | |||
"type": 5, | |||
"description": "Round: 681048", | |||
"collection": 24, | |||
"path": "/dir-49/dir-49/dir-49/file-1" | |||
}, | |||
... | |||
... | |||
] | |||
} | |||
</pre> | |||
Display 20 items, starting at item 0, of type sync, clear all session parameters | |||
URL: http://localhost:8080/ace-am/EventLog?start=0&count=20&toggletype=sync&clear=1&json=1 | |||
Output: | |||
<pre> | |||
{ | |||
"start": 0, | |||
"count": 20, | |||
"filter": ["sync"], | |||
"events": [ | |||
{ | |||
"id": 25296472, | |||
"date": "Thu Jan 08 15:09:05 EST 2009", | |||
"session": 1231445345516, | |||
"type": 20, | |||
"description": "", | |||
"collection": 23, | |||
"path": "/" | |||
}, | |||
{ | |||
"id": 25296473, | |||
"date": "Thu Jan 08 15:09:14 EST 2009", | |||
"session": 1231445345516, | |||
"type": 21, | |||
"description": "", | |||
"collection": 23, | |||
"path": "/" | |||
} | |||
] | |||
} | |||
</pre> |
Revision as of 20:23, 14 January 2009
The following functionality is visible through a JSON interface. To generate JSON output, append json=1 to the request on any supported servlet.
/Status
Returns an overview of all collections in the current ACE installation
Parameters
- none
Output
A list containing the replication details for all collections is returned. Unless otherwise noted, all values are strings
collections : [ - array containing the following properties id - numeric ID of collection (long) name - descriptive name directory - base directory lastSync - date of last sync (Tue Sep 23 12:31:21 EDT 2008) storage - string name for storage type checkPeriod - int for number of days to check collection proxyData - boolean, true if data may be proxied through ACE auditTokens - boolean, should digests and tokens be audited along w/ files state - char, current state of collection .... totalFiles - long, number of files in collection fileAuditRunning - boolean, true if a file audit is in progress tokenAuditRunning - boolean, true if a token audit is in progress The following objects will ONLY exist if a file or token audit is running fileAudit : { totalErrors - long, total number of errors encountered thus far newFilesFound - long, new files found in collection filesSeen - long, total files processes so far lastFileSeen - last file processed tokensAdded - long, new tokens issued during this audit } tokenAudit : { totalErrors - long, total number of errors encountered thus far tokensSeen - long, total number of digests/tokens loaded validTokens - number of tokensa/digests validated against round summaries } ]
Example
Invoking URL: http://localhost:8080/ace-am/Status?json=1
Output
{"collections": [ { "id": 18, "name": "3 layer, 10files, 50dirs", "directory": "/", "lastSync": "Wed Jan 07 12:25:54 EST 2009", "storage": "benchmark", "checkPeriod": 0, "proxyData": false, "auditTokens": false, "state": "A", "totalFiles": 1250000, "fileAuditRunning": true, "tokenAuditRunning": false, "fileAudit": { "totalErrors": 0, "newFilesFound": 0, "filesSeen": 161468, "lastFileSeen": "/dir-6/dir-22/dir-46/file-7", "tokensAdded": 0 } } ]}
/EventLog
Event log is a session away log servlet that can be used to query for log events. Events are attached to a collection, a particular invocation of an audit called a session, and to a particular item by path.
Parameters
- start - log entry id to start display at
- count - number of results to return
- toggletype - filter to toggle, one of 'errors','missing','newmaster','sync'
- top
- sessionId - sessionID to get events for, or set to 0 to clear
- logpath - path to get events for, or set to empty to clear
- collection - collection to retrieve events for, or set to 0 to clear
- clear - set to 1 to reset any filters, if you do not want to cache filters, then you can supply this with every call
Output
Log items along with current paging and query information for the log
start - long, starting log entry count - int, number of entries asked for (actual results may be less) session - long, current session filter if any (opt) collection - long, current collection filter (opt) logpath - current path filter (opt) filter - array of currently used filters, 'errors','missing','newmaster','sync' events : [ array containing log events id - long, numeric ID of log entry date - timestamp of entry session - long, session this entry belongs to type - int, type of log entry, complete list available at [Ace:Log Messages] collection - long, collection this entry is attached to (opt) path - path this item is attached to description - descriptive message for this entry ]
Example
Display default (last 20) listings
URL: http://localhost:8080/ace-am/EventLog?clear=1&json=1
Output:
{ "start": 0, "count": 20, "filter": [], "events": [ { "id": 27796479, "date": "Thu Jan 08 21:03:06 EST 2009", "session": 1231448172510, "type": 5, "description": "Round: 681048", "collection": 24, "path": "/dir-49/dir-49/dir-49/file-0" }, { "id": 27796480, "date": "Thu Jan 08 21:03:06 EST 2009", "session": 1231448172510, "type": 5, "description": "Round: 681048", "collection": 24, "path": "/dir-49/dir-49/dir-49/file-1" }, ... ... ] }
Display 20 items, starting at item 0, of type sync, clear all session parameters
URL: http://localhost:8080/ace-am/EventLog?start=0&count=20&toggletype=sync&clear=1&json=1
Output:
{ "start": 0, "count": 20, "filter": ["sync"], "events": [ { "id": 25296472, "date": "Thu Jan 08 15:09:05 EST 2009", "session": 1231445345516, "type": 20, "description": "", "collection": 23, "path": "/" }, { "id": 25296473, "date": "Thu Jan 08 15:09:14 EST 2009", "session": 1231445345516, "type": 21, "description": "", "collection": 23, "path": "/" } ] }