LogoLogo
  • User Guide
    • Getting Started
      • Building a Usage-Based Product in Revenium
      • Setting Up & Using API Analytics & Observability
      • Setting Up & Using Product Analytics
      • Sending Data to Revenium's Metering API
      • Key Concepts & Relationships
    • Connect Your Data
      • cURL Commands for Testing
      • Container-Native Metering
      • Kong
        • Kubernetes Installation
      • Salesforce
        • Revenium Unmanaged Package
          • Anypoint API Experience Hub (AEH)
            • Anypoint API Experience Hub Unmanaged Package Post Installation Instructions
          • Anypoint Community Manager (ACM)
            • Anypoint Community Manager Package Post Installation Instructions
        • Revenium Lightning Web Components
          • Add Components to Experience Cloud site
          • Drop-In Storefront
          • Product Card
          • Product Card (Anypoint)
          • Product Checkout
          • Product Details Button
          • Usage History
          • API Access Requester
      • MuleSoft
        • Metering Policy Configuration
        • Offline Metering Policy Configuration
        • Anypoint API & API Group Synchronization
        • Revenium Connector
        • Disable Default Anypoint Community Manager (ACM) Email Notifications
      • Gravitee
      • Istio
      • Envoy
      • AWS API Gateway
      • Python & Django
      • Golang
      • Spring Boot
      • .Net
      • NodeJs
      • Java/JVM
      • Snowflake
      • Azure API Management
      • IBM
      • Custom Integrations Using Metering Beacons
        • JWT Enrichment
      • Offline Metering via Log Parsing
    • Sources
      • Metering Elements
      • Alerts
        • Alert History
    • API Keys
    • Products & Pricing
      • Product Lines
      • Pricing Rules
        • Revenium Scripting Language
          • RSL Reference
        • Execution Logs
      • SLA Definitions
      • SLA Violation Review
    • Customers
      • Customers
      • Subscribers
      • Subscriptions
      • Subscribers Credentials
      • Subscribers Notifications
    • Billing and Invoicing
      • Manage Refunds
    • Analytics
      • Revenue Analytics
      • Product Analytics
        • Custom Reports (Products)
      • Subscriber Analytics
        • New Subscribers
        • (Daily/Weekly/Monthly) Active Subscribers
        • Most Engaged Subscribers & Customers
        • Historical Usage
      • API Analytics
        • Performance & Availability
        • Compare Periods
        • Traffic by Geography
        • Advanced Search
        • Custom Reports
    • Profile
      • Profile
      • Revenium API Documentation
    • Settings
      • Revenium Users & Organizations
        • Access Permissions by User Type
      • Revenium Subscription
      • Revenium Organizations
      • Notification Templates
      • Transactions Logs
        • Analytics Transaction Log
        • Product Transaction Log
        • Subscription Audit Log
        • No Code Transaction Testing
      • Integrations
        • Data Sync
        • Export Configurations
        • Notification Providers
        • Payment Configurations
          • Customer VAT ID Support
        • ERP Configurations
        • External Integration Logs
        • Identity Providers
      • System Logs
      • Default Configuration Limits
Powered by GitBook

© Revenium - www.revenium.io

On this page
  • Offline Metering Architecture
  • Example Logstash Configuration
  1. User Guide
  2. Connect Your Data

Offline Metering via Log Parsing

Allows the productization and metering of APIs without an API gateway

Last updated 10 months ago

Before investigating an offline/log-based integration, we recommend you review our Linux & here, which works in a variety of environments and is configurable with only a few lines of additional code.

Offline Metering is useful in situations where an API is being consumed without an API Gateway, or when you wish to meter any type of transaction asynchronously to achieve zero additional latency at the time of transaction (whether using a gateway or not).

This metering method enables a specialized audit trail of API transaction metadata that can be scraped "offline" by Logstash and sent to Revenium for metering.

Offline Metering Architecture

Offline Metering allows the ingest of metering data without, or in addition to, traditional metering via an API Gateway. Using a log scraping frameworks such as and arbitrary log files like web server access logs, firewall logs, loadbalancer logs, etc can be used as sources for API metering data.

Log entries must contain the following API metadata to be metered:

  • The Revenium Source ID OR the URL/URI of the API request

    • The most common method is to use the URI/URL of the request (using the parameterurl), which will automatically create an associated source in Revenium.

    • If you've pre-created sources in Revenium, you can use an existing SourceId instead of url. The parameter to pass in this case is api

  • An application identifier (parameter =application), this allows us to track which of your subscribers or applications are using each of your APIs.

  • The response code (parameter = responseCode) indicating success or failure (i.e. 200 series responses for success vs. 500 series responses for failures)

    • This is required so that your clients are never charged for failed transactions in the case of monetized APIs.

Example Logstash Configuration

The following documents an example Filebeat and Logstash configuration that parses and submits metering data from a Jetty webserver log in realtime.

Here is the Filebeat configuration to tail the Jetty log file.

filebeat.inputs:

- type: filestream
  id: revenium
  enabled: true
  paths:
    - /jetty/logs/jetty.log

And here is the Logstash configuration to parse and send the metering request to the Revenium platform.

input {
  beats {
    port => 5044
  }
}

output {
  http {
    url => "https://api.revenium.io/meter/v1/api/event"
    http_method => "post"
    responseCode => "200"
    application => "12345"
    message => "%{message}"
    content_type => "application/json"
    format => "message"
    retry_failed => true
    headers => [
      'x-api-key', 'hak_123456789'
    ]
  }
}

Note you'll need to replace the x-api-key below with your own .

Integration Key
container-native metering solution
Filebeat
Logstash
Offline Metering of Logfiles Using Filebeat and Logstash