My App

Logs API

Send structured logs to Fivemanage for monitoring and debugging

Send structured logs to Fivemanage for centralized monitoring, debugging, and analytics. Perfect for FiveM servers, applications, and services.

Prerequisites

Create a Logs token in your dashboard before sending logs.

Send Logs

const response = await fetch('https://api.fivemanage.com/api/logs', {
    method: 'POST',
    headers: {
        'Authorization': 'YOUR_LOGS_TOKEN',
        'Content-Type': 'application/json',
        'X-Fivemanage-Dataset': 'default' // Optional dataset
    },
    body: JSON.stringify({
        level: 'info',
        message: 'Player connected to server',
        metadata: {
            playerId: '12345',
            serverName: 'My FiveM Server',
            action: 'player_connect'
        }
    })
});

const result = await response.json();
console.log('Log sent:', result);
curl -X POST https://api.fivemanage.com/api/logs \
  -H "Authorization: YOUR_LOGS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "X-Fivemanage-Dataset: default" \
  -d '{
    "level": "error",
    "message": "Database connection failed",
    "metadata": {
      "error": "Connection timeout",
      "database": "players",
      "retry_count": 3
    }
  }'
-- Using exports (if using Fivemanage SDK)
exports.fmsdk:Log('default', 'info', 'Player spawned', {
    playerSource = source,
    playerName = GetPlayerName(source),
    coordinates = GetEntityCoords(GetPlayerPed(source))
})

-- Or direct HTTP request
PerformHttpRequest('https://api.fivemanage.com/api/logs', function(err, text, headers)
    if err == 200 then
        print('Log sent successfully')
    end
end, 'POST', json.encode({
    level = 'warn',
    message = 'Player attempted invalid action',
    metadata = {
        playerId = source,
        action = 'invalid_command'
    }
}), {
    ['Authorization'] = 'YOUR_LOGS_TOKEN',
    ['Content-Type'] = 'application/json',
    ['X-Fivemanage-Dataset'] = 'security'
})

Log Structure

FieldTypeRequiredDescription
levelStringYesLog level: debug, info, warn, error
messageStringYesHuman-readable log message
metadataObjectNoAdditional structured data

Headers

HeaderRequiredDescription
AuthorizationYesYour logs API token
X-Fivemanage-DatasetNoDataset name for organization (defaults to "default")

Log Levels

Use appropriate log levels for better filtering and alerting:

  • debug - Detailed information for debugging
  • info - General information about application flow
  • warn - Warning messages for potentially harmful situations
  • error - Error events that might still allow the application to continue

Datasets

Organize logs into datasets for better filtering:

// Different datasets for different purposes
fetch('https://api.fivemanage.com/api/logs', {
    headers: {
        'X-Fivemanage-Dataset': 'security'  // Security-related logs
    }
});

fetch('https://api.fivemanage.com/api/logs', {
    headers: {
        'X-Fivemanage-Dataset': 'economy'   // Economy system logs
    }
});

Dashboard Features

Your logs automatically get powerful dashboard features:

  • Real-time Search - Filter by message, metadata fields, or log level
  • Custom Columns - Add metadata fields as searchable columns
  • Saved Searches - Save frequently used search queries
  • Discord Webhooks - Get notified of important events
  • Time Range Filtering - View logs from specific time periods

Visit the logs dashboard to explore and analyze your logs with advanced filtering and search capabilities.