Skip to main content

What Is Tyk Pump?

Tyk Gateway writes a traffic log, a structured record of the request and response, for every API call it processes, into Redis. Redis is a temporary, high-throughput buffer, not a long-term store, so something has to move those traffic logs out before they expire. Tyk Pump is the open source component that does this. It reads traffic logs out of Redis and writes them to one or more configured destinations, which Tyk calls pumps. Each pump has a type, such as mongo or sql, from the Pump Type Catalog below: depending on the type, it can forward traffic logs unaltered, or compute aggregated analytics or metrics from them. A single Tyk Pump process can run several pumps at once, so the same traffic data can be sent to multiple destinations in parallel.
For new integrations, we recommend OpenTelemetry tracing, since it gives you richer per-request detail without the Redis and Tyk Pump hop, and OpenTelemetry metrics instead.
A Note on Terminology Throughout this documentation, “Tyk Pump” (capitalized) always refers to the component itself. “A pump” or “pump type” refers to one of its configured destinations, such as the mongo or hybrid pump type. Tyk Pump serves four distinct outcomes, covered in full elsewhere in the documentation:
  • Populating Tyk Dashboard’s built-in Traffic Analytics UI and Log Browser. These have no other source of data. This is the primary, ongoing purpose of Tyk Pump. See Dashboard Analytics.
  • Forwarding traffic logs, unaltered, to external systems such as Splunk or Datadog. See External Data Sinks.
  • Exposing metrics derived from traffic logs to Prometheus, StatsD, or DogStatsD. See Metrics Pumps.
  • Storing the results of Tyk Gateway’s own uptime tests, periodic health checks against upstream hosts, for Tyk Dashboard’s separate Uptime Tests reporting screen. Unlike the other three, the dedicated uptime pump doesn’t work with traffic log data. See Uptime Tests.
This page covers what applies to Tyk Pump regardless of which of those goals you’re pursuing: installation, the shape of pump.conf, and the full catalog of available pump types.
Tyk Pump is not configurable in Tyk Cloud.

Architecture

The architecture differs depending on your deployment model:
Tyk Enterprise Pump Architecture
Tyk Pump is flexible: you can run multiple pumps in a single instance to write the same traffic data to several destinations at once. It’s also scalable, both horizontally and vertically. The figure below shows each Tyk Pump instance (“1”, “2”, and “n”) running two pumps concurrently, labeled Pump Backend (i) and (ii), with pump_type: "mongo" and pump_type: "elasticsearch" respectively. Tyk Pump can be horizontally scaled without causing duplicate data, provided your configuration follows one of the supported combinations below: You can apply filters to control which records go to which destination: see Sharding Analytics to Different Data Sinks.

Installing Tyk Pump

Tyk Pump is installed as part of a Tyk Self-Managed or Tyk Open Source deployment. See the Tyk Self-Managed installation options or Tyk Open Source installation for platform-specific instructions (Docker, Kubernetes, Linux packages). Set the TYK_PMP_OMITCONFIGFILE environment variable to omit pump.conf entirely and configure Tyk Pump purely from environment variables. This is particularly useful in Docker, since the Tyk Pump image ships with a default configuration file with pre-loaded pumps.

Configuring Tyk Pump

Tyk Pump is configured through a JSON file, conventionally called pump.conf, or through equivalent environment variables:
For the full field-by-field reference, environment variable names, and default values for every pump type, see the Tyk Pump configuration reference. For the fields contained in a traffic log itself, see Traffic Log Field Reference.

Connecting to Redis

analytics_storage_config is the Redis instance Tyk Pump reads traffic logs from, the same Redis that Tyk Gateway writes to. For single-node, Cluster, and Sentinel configuration, connection pool tuning, and TLS, see Configure Redis, which covers Tyk Gateway, Tyk Dashboard, and Tyk Pump together.

Purge Configuration

Logging and Health Checks

Instrumentation

statsd_connection_string and statsd_prefix configure Tyk Pump to send its own operational metrics to a StatsD server, separate from any traffic-derived metrics sent by the statsd/dogstatsd Metrics Pumps. Only takes effect when TYK_INSTRUMENTATION=1 is set. See Configuring StatsD for details.

Uptime Test Results

uptime_pump_config stores the results of Tyk Gateway’s own uptime tests, periodic health checks against upstream hosts. It’s unrelated to traffic logs and configured independently of pumps. See Uptime Tests for configuration.
dont_purge_uptime_data defaults to false, which starts an Uptime Pump on every Tyk Pump launch, even if you haven’t configured a real uptime_pump_config target. If it can’t connect to a persistent store, Tyk Pump exits immediately, taking down every other pump in that instance too.Set dont_purge_uptime_data: true if you’re not using the Uptime Pump.

Declaring Pumps

At least one pump must be configured in the pumps object:
<pump-name> is more than a label: it’s also the environment variable prefix for that pump, TYK_PMP_PUMPS_<PUMP-NAME>_. For example, naming a pump PROD lets you configure it with TYK_PMP_PUMPS_PROD_TYPE, TYK_PMP_PUMPS_PROD_META_..., and so on, whether or not it’s also declared in pump.conf. If you omit type from the JSON block entirely, Tyk Pump also falls back to using <pump-name> itself as the type. Beyond that, <pump-name> is logged once, when Tyk Pump starts up, and then dropped: at runtime, warnings, errors, and metrics identify a pump by its type’s display name (for example, “Mongo Pump”), not by this name. If you run multiple instances of the same type, choose names that help you tell them apart in configuration, but expect their ongoing logs to look identical. The type is selected from the Pump Type Catalog and determines the specific meta configuration; there is also common configuration that is applicable to all pump types.

Common Pump Settings

Every pump entry accepts the following settings, alongside its type and meta:

Sharding Analytics to Different Data Sinks

In a multi-Organisation deployment, each Organisation, team, or environment might have a preferred destination. The filters field, available on every pump, lets you control which records are sent to which pump using an allowlist and a blocklist:
  • api_ids, org_ids, and response_codes act as an allowlist: only matching records are sent to this pump.
  • skip_api_ids, skip_org_ids, and skip_response_codes act as a blocklist: matching records are never sent to this pump.
  • The blocklist always takes priority over the allowlist.
For example, this configuration sends all analytics for org1 and org2 to a CSV file, and everything except api_id_1 to Elasticsearch:

Pump Timeout

By default, Tyk Pump waits indefinitely for each write operation to complete (timeout: 0). You can configure an optional timeout, in seconds, per pump:
If a pump’s write operation takes longer than the purge loop interval (purge_delay) and no timeout is configured, Tyk Pump logs: Pump PMP_NAME is taking more time than the value configured of purge_delay. You should try to set a timeout for this pump. If a timeout is configured and the pump is still falling behind, it logs: Pump PMP_NAME is taking more time than the value configured of purge_delay. You should try lowering the timeout configured for this pump.

Omit Detailed Recording

omit_detailed_recording, set on a pump, stops that pump from writing the raw_request and raw_response fields for every record. Defaults to false.

Max Record Size

max_record_size caps the size, in bytes, of the raw_request and raw_response fields written by a pump. Defaults to 0 (unlimited). Set it at the top level of pump.conf to apply a default to every pump:
Or set it on a specific pump instead, which takes precedence over the global default for that pump only:

Ignore Fields

ignore_fields lists fields, by JSON tag, to exclude when a pump writes its record. Useful for keeping sensitive or unneeded data out of a specific destination:

Decode Raw Request and Raw Response

When detailed recording is configured in Tyk Gateway, the full request and response will be base64-encoded and stored in the raw_request and raw_response fields respectively in the traffic log. The pump can optionally remove the base64-encoding before writing the record to the target, which avoids the need for post-processing by your analytics package. Decoding of request and response are individually controlled using raw_request_decoded and raw_response_decoded (both default to false).
Do not decode the request and response data when transferring the unaggregated traffic logs to the control plane’s persistent storage for Tyk Dashboard’s Log Browser. The Dashboard automatically base64-decodes this data when displaying a record; if this decoding has already been performed by Tyk Pump, the result will be nonsense in the Log Browser display. Only decode for destinations that read the data directly, such as an external sink.

Pump Type Catalog

Tyk Pump’s pump types fall into three categories, each covered in more detail on its own page. Every pump type is configured the same way: an entry under pumps with a type and a meta block.
This doesn’t include the uptime pump, covered separately under Uptime Test Results above.

Dashboard Analytics Pumps

Dashboard Analytics pumps transfer, and in some cases aggregate, traffic logs to the persistent storage. Tyk Dashboard’s Log Browser and Traffic Analytics screens require different data and hence separate pumps. When using a combined control and data plane deployment (such as with the tyk-stack chart), you only need Control Plane Pumps. When using a distributed deployment with separate control and data planes, connected via Tyk MDCB, you also need a Data Plane Pump to get the data to the control plane.

Control Plane Pumps

Unlike Mongo, SQL has an aggregate GraphQL pump; there’s no mongo-graph-aggregate equivalent.

Data Plane Pump

For separate control and data planes you must transfer the traffic logs from the data plane (where they are generated) to the control plane (where they are used by Tyk Dashboard). A hybrid pump should be deployed in each data plane to transfer the records to Tyk MDCB. As explained in the dedicated Data Plane Pump section, once data reaches Tyk MDCB, it must be transferred to the control plane’s persistent storage via one of two options: Tyk MDCB’s own built-in writer or a Control Plane Pump: an ordinary Tyk Pump instance running one of the pump types listed above.
The hybrid pump can create aggregated analytics from MCP proxy and standard REST API traffic logs, but cannot create aggregated analytics for GraphQL API traffic.

External Data Sink Pumps

Forward traffic logs, unaltered, to external tools. Considered the legacy approach: for new integrations, use OpenTelemetry tracing instead.

Metrics Pumps

Derive per-request metrics from traffic logs, rather than forwarding the full record. Considered the legacy approach: for new integrations, use OpenTelemetry metrics instead.
Some pump types accept a filters object to restrict which Organisations or APIs they receive data for; see Sharding Analytics to Different Data Sinks above.

Demo Mode

Tyk Pump can generate synthetic analytics data and send it to your configured pumps, without needing any live API traffic. This is useful for previewing Tyk Dashboard’s Traffic Analytics and Log Browser with realistic-looking data, for example while evaluating Tyk, or for testing a new pump configuration in isolation before pointing it at live traffic. Demo mode is controlled by command-line flags when starting Tyk Pump, not by pump.conf or environment variables. --demo is required to enable it; the rest are optional and customize the generated data: