Statistics
Retrieve aggregated statistics and insights about your audit log activity.
Stats Endpoint
GET
/stats
Get statistical information about your audit log events, including total counts, recent activity, and top actions.
Required Scope
events:read
Response
| Field | Type | Description |
|---|---|---|
total_events |
integer | Total number of events in your audit log |
events_last_24h |
integer | Number of events created in the last 24 hours |
events_last_30d |
integer | Number of events created in the last 30 days |
top_actions |
array | Array of objects containing the most frequent actions and their counts |
Examples
curl -X GET "https://logproof.de/v1/stats" \ -H "Authorization: Bearer YOUR_API_KEY"
<?php
$client = new \GuzzleHttp\Client();
$response = $client->get('https://logproof.de/v1/stats', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY',
],
]);
$data = json_decode($response->getBody(), true);
echo "Total events: {$data['data']['total_events']}\n";
echo "Events (last 24h): {$data['data']['events_last_24h']}\n";
echo "Events (last 30d): {$data['data']['events_last_30d']}\n";
echo "\nTop actions:\n";
foreach ($data['data']['top_actions'] as $action) {
echo "- {$action['action']}: {$action['count']}\n";
}
const axios = require('axios');
async function getStats() {
try {
const response = await axios.get('https://logproof.de/v1/stats', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const stats = response.data.data;
console.log(`Total events: ${stats.total_events}`);
console.log(`Events (last 24h): ${stats.events_last_24h}`);
console.log(`Events (last 30d): ${stats.events_last_30d}`);
console.log('\nTop actions:');
stats.top_actions.forEach(action => {
console.log(`- ${action.action}: ${action.count}`);
});
} catch (error) {
console.error('Failed to retrieve stats:', error.message);
}
}
getStats();
import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.get(
'https://logproof.de/v1/stats',
headers=headers
)
data = response.json()['data']
print(f"Total events: {data['total_events']}")
print(f"Events (last 24h): {data['events_last_24h']}")
print(f"Events (last 30d): {data['events_last_30d']}")
print("\nTop actions:")
for action in data['top_actions']:
print(f"- {action['action']}: {action['count']}")
Example Response
{
"data": {
"total_events": 45821,
"events_last_24h": 127,
"events_last_30d": 3456,
"top_actions": [
{
"action": "user.login",
"count": 8234
},
{
"action": "document.view",
"count": 6891
},
{
"action": "user.logout",
"count": 5432
},
{
"action": "document.edit",
"count": 3210
},
{
"action": "user.settings.update",
"count": 2187
}
]
}
}
Use case: Use the stats endpoint to build dashboards, monitor activity trends, and identify the most common actions in your application.