Event Ingestion Integration

The Event Ingestion Integration allows you to convert arbitrary JSON events into logs that can be ingested and analyzed in Metoro. This is particularly useful when you want to send custom events, webhooks, or any JSON-structured data to be processed as logs.

Overview

The integration provides a simple HTTP endpoint that accepts JSON payloads and converts them into structured logs. Each event is automatically enriched with metadata such as service name and environment, making it easy to filter and analyze the data in Metoro’s log viewer.

Getting Started

Prerequisites

  • Admin access to your Metoro organization
  • HTTP client capable of making POST requests with JSON payloads

Setting Up Event Ingestion

  1. Navigate to the Settings > Integratios > Event Ingestion section.
  2. Click the “Add Token” button (requires admin privileges)
  3. Fill in the required information:
    • Service Name: A unique identifier for the service sending events (e.g., “payment-webhook”)
    • Environment: The environment this integration will be used in (e.g., “production”)
  4. Click “Create Token” to generate your ingestion token

Metoro Ingestion Endpoint https://us-east.metoro.io/api/v1/webhook/event/log

Using the Integration

To send events to Metoro, make HTTP POST requests to the ingestion endpoint with your token:

curl -X POST https://us-east.metoro.io/api/v1/webhook/event/log \
  -H "Authorization: Bearer <your-token>" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Payment succeeded",
    "amount": 2000,
    "currency": "USD",
    "customer_id": "cus_111",
    "metadata": {
      "source": "stripe"
    },
    "level": "info"
  }'

Payload Structure

The JSON payload can contain any valid JSON structure. Metoro will automatically:

  • Parse the JSON structure
  • Convert it into a log entry
  • Enrich it with your service name and environment
  • Make it searchable in the Logs section

Log Level and Message Handling

  • Metoro will guess the log level based on the presence of certain fields (e.g., “error” or “info”)
    • If you want to override the log level, you can include a level or severity field in your payload with values like “info”, “warn”, “error”, etc.
  • As the log message, Metoro will try to use message or msg fields if present, otherwise it will use the entire payload as the message.

Managing Tokens

  • View Tokens: Administrators can view all existing tokens in the Event Ingestion section
  • Copy Token: Use the copy button next to each token to copy it to your clipboard
  • Delete Token: Remove tokens that are no longer needed (this action cannot be undone)

Security Considerations

  • Keep your ingestion tokens secure and treat them like secrets
  • Delete and re-create tokens if you suspect they have been compromised
  • Use environment-specific tokens to maintain separation between environments
  • Only administrators can manage tokens to maintain security

Best Practices

  1. Structured Data: Send well-structured JSON data to make it easier to query and analyze
  2. Meaningful Names: Use descriptive service names that clearly indicate the source of events
  3. Environment Separation: Create separate tokens for different environments
  4. Token Management: Regularly audit and remove unused tokens
  5. Error Handling: Implement proper error handling in your integration code to handle failed requests

Viewing Events

Once events are ingested:

  1. Navigate to the Logs section in Metoro
  2. Filter by your service name to see ingested events
  3. Use the search and filter capabilities to analyze your data
  4. Create dashboards and alerts based on your ingested events

Limitations

  • Tokens cannot be edited after creation (delete and create new ones if needed)

Troubleshooting

Common issues and solutions:

  1. Authentication Failed

    • Verify you’re using the correct token
    • Check if the token is still active
    • Ensure the “Authorization” header is properly formatted
  2. Invalid JSON

    • Validate your JSON payload before sending
    • Check for proper escaping of special characters
    • Ensure the Content-Type header is set to “application/json”

For additional support, contact Metoro support or join our community Slack channel.