Skip to content

/system/user_logs

Path: /system/user_logs
Namespace: system
Resource: user_logs

Overview

The User Log resource in the system namespace provides system administrators with access to user activity logs across all domains for system-wide monitoring and auditing.

Key Difference from Admin: The system namespace provides cross-tenant access for system administrators, while the admin namespace is scoped to a single domain.

Relationships

See Admin User Logs for complete relationship documentation. System user logs use the same UserLog model with system-wide access.

Key Features

  • System-Wide Access: Access to all user logs across all tenants
  • Cross-Tenant Monitoring: Monitor user activity across all tenants
  • System Administration: Full administrative control over all user logs
  • Same UserLog Model: Uses the same UserLog model as admin namespace

Available Operations

List User Logs (GET)

Endpoint: GET /system/user_logs.json

Query Parameters:

  • q[field_predicate]=value - Ransack query filters for advanced filtering
  • scope=name - Apply named scope (e.g., yours, others, user, guest, success, exception)
  • page=N - Page number for pagination
  • per_page=N - Items per page (default: 25)

Request Examples:

bash
curl -X GET "https://your-company.erpax.com/system/user_logs.json" \
  -H "Accept: application/json" \
  -H "Cookie: session_cookie"
bash
curl -X GET "https://your-company.erpax.com/system/user_logs.json?scope=exception" \
  -H "Accept: application/json"

JavaScript Example:

javascript
const response = await fetch('/system/user_logs.json', {
  credentials: 'include',
  headers: { 'Accept': 'application/json' }
});
const data = await response.json();

Response (200 OK):

json
{
  "user_logs": [
    {
      "id": 1,
      "user_id": 1,
      "remote_ip": "192.168.1.1",
      "request_method": "GET",
      "url": "/admin/invoices",
      "namespace": "admin",
      "controller": "invoices",
      "action": "index",
      "created_at": "2024-01-15T10:00:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "per_page": 25,
    "total_pages": 10,
    "total_count": 250
  }
}

Show User Log (GET /:id)

Endpoint: GET /system/user_logs/:id.json

Request Example:

bash
curl -X GET "https://your-company.erpax.com/system/user_logs/1.json" \
  -H "Accept: application/json" \
  -H "Cookie: session_cookie"

Response (200 OK):

json
{
  "user_log": {
    "id": 1,
    "user_id": 1,
    "remote_ip": "192.168.1.1",
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "request_method": "GET",
    "url": "/admin/invoices",
    "namespace": "admin",
    "controller": "invoices",
    "action": "index",
    "content_length": 1024,
    "ssl": true,
    "xhr": false,
    "exception": null,
    "created_at": "2024-01-15T10:00:00Z"
  }
}

Note: User logs are typically read-only and created automatically by the system. Create, update, and delete operations are typically not available.

Scopes

See Admin User Logs for complete scope documentation. System namespace supports the same scopes as admin namespace, but across all tenants.

Filters

See Admin User Logs for complete filter documentation. System namespace supports the same filters as admin namespace, but across all tenants.

Business Rules

  • System-Wide Access: System namespace provides access to all user logs across all tenants
  • Cross-Tenant Monitoring: System administrators can monitor user activity across all tenants
  • Read-Only: User logs are typically read-only and created automatically by the system
  • Same Business Rules: Follows the same business rules as admin namespace user logs

Released under an open source license.