Log Enrichment in OpenTelemetry Collector: Lookups and GeoIP

Log enrichment in the OpenTelemetry Collector now includes an alpha lookup processor. Use YAML, CSV, DNS, GeoIP, and cache rules without hiding pipeline risk.

Isometric OpenTelemetry Collector switchboard connected to reference tables, GeoIP storage, a cache, and enriched logs

Contents

Log enrichment used to mean “parse the line and add a few attributes.” That is still part of the job, but it is no longer the whole job. Teams moving log pipelines to the OpenTelemetry Collector often need reference data: service ownership, customer tier, store region, hostnames, GeoIP fields, or a default value when an ID is missing from a table.

The Collector story changed recently. The contrib repository now has an alpha lookup processor that evaluates an OTTL expression as a key, queries a source, and writes the result back as attributes. Checked on December 2, 2026, it supports YAML, CSV, and DNS sources, plus caching. It is not in the official contrib or Kubernetes distributions yet, so using it today means a custom Collector build.

This guide is version-stamped against opentelemetry-collector-contrib main on December 2, 2026. The lookup processor is alpha, the geoip processor is alpha, and the examples here may need changes for the exact Collector version you run.

What is log enrichment?

Log enrichment is the process of adding context to a log record before it reaches storage. In the OpenTelemetry Collector, that context can come from the record itself, the resource, a static lookup table, DNS, or a GeoIP database.

The useful distinction is where the context comes from:

Enrichment typeExampleCollector fit
Parsing and derivationExtract tenant_id from a structured log bodyUse transform or filelog operators
Resource metadataAdd k8s.cluster.name or deployment.environmentUse SDK resources, k8sattributes, or transform
Static reference dataMap service.name to team.ownerUse the alpha lookup processor with YAML or CSV
Network reference dataAdd city-level geolocation from an IP addressUse geoip with a supported MaxMind City database
Live external enrichmentQuery an HTTP API, Redis, or a databaseNot built in today; requires custom source code or a custom processor

If you only need deterministic rewrites, keep it simple. The sampling, filtering, and enrichment guide covers resource attributes and transform basics. This post focuses on the lookup and GeoIP edge: the place where the context is outside the telemetry item.

What works today for enrichment

The stable path is still the transform processor. Its README marks traces, metrics, and logs as stable, and the older attributes and resource processors now say they are superseded by transform. Use transform when the value can be computed from fields already present in the telemetry.

For example, normalize environment labels before export:

processors:
transform/normalize:
error_mode: ignore
log_statements:
- context: log
statements:
- set(resource.attributes["deployment.environment"], "production") where resource.attributes["env"] == "prod"
- set(log.attributes["severity.normalized"], "error") where IsMatch(log.severity_text, "(?i)err|error|fatal")

That kind of log enrichment stays local. It avoids network calls, cache state, and external availability dependencies. It should be your default choice for derivation, cleanup, and schema normalization.

The next tier is contextual metadata. Kubernetes metadata, cloud attributes, service names, and deployment environments are usually stable enough to attach at the SDK, agent, or gateway layer. Our OpenTelemetry Collector architecture guide explains where processors sit in the pipeline, and the Last9 Processors and Transforms docs show filter and transform examples before data reaches Last9.

Use the heavier lookup patterns only when a value is external. If a service can emit team.owner itself, do that instead of making every log line query a table.

The lookup processor: what it covers now

The new lookup processor fills the reference-data gap. It evaluates a configured OTTL value expression, converts the result to a string key, queries a source, and writes one or more attributes.

A minimal YAML-backed lookup looks like this:

processors:
lookup/service_owner:
source:
type: yaml
path: /etc/otel/service-owners.yaml
reload_interval: 5m
lookups:
- key: resource.attributes["service.name"]
context: resource
attributes:
- source: team
destination: team.owner
default: "unknown"
- source: tier
destination: service.tier
default: "standard"

The YAML file can return a scalar value or a map:

checkout:
team: payments
tier: critical
catalog:
team: storefront
tier: standard

That is a clean fit for service ownership, environment aliases, store region, workload tier, and other bounded maps. YAML and CSV sources can reload periodically. The CSV source README also documents reload metrics: lookup_source_reloads and lookup_source_reload_failures. Alert on the failure counter if the lookup table must stay fresh.

The processor also supports DNS. A reverse lookup can attach a hostname to a client IP:

processors:
lookup/reverse_dns:
source:
type: dns
record_type: PTR
timeout: 1s
cache:
enabled: true
size: 10000
ttl: 5m
negative_ttl: 1m
lookups:
- key: log.attributes["client.ip"]
attributes:
- destination: client.hostname
default: "unknown"

The DNS source enables caching by default. Its README lists PTR, A, and AAAA records, plus successful and negative cache TTLs. That matters because a DNS miss can be just as expensive as a DNS hit if every log record repeats it.

The practical catch is distribution. The lookup processor status table says Distributions: []. It was added as an alpha component, but the official otelcol-contrib and otelcol-k8s manifests checked on December 2, 2026 do not include it. To run it today, build a custom Collector with the OpenTelemetry Collector Builder and add github.com/open-telemetry/opentelemetry-collector-contrib/processor/lookupprocessor to your builder manifest.

Where lookup enrichment still falls short

The original upstream discussion for an enrichment processor called out two gaps: reference-data lookup and dynamic external enrichment. The alpha lookup processor now covers part of the first gap. It does not close the second one by default.

Built-in sources today are noop, yaml, csv, and dns. The discussion mentions HTTP APIs, databases, Redis, and Memcached as possible remote lookup targets, but those are not built-in sources in the README checked for this post. You can add custom sources in code with NewFactoryWithOptions and WithSources, but that moves the problem from configuration to software ownership.

That ownership is not a formality. A remote lookup source needs answers for:

  • timeout behavior when the service is slow
  • cache size, TTL, and negative caching
  • response schema changes
  • authentication and secret rotation
  • concurrency limits
  • metrics for lookup latency, hit rate, failures, and fallback use
  • behavior when the Collector reloads or shuts down

If you cannot own those, keep the lookup outside the Collector. Enrich the event before it is emitted, or add the business context downstream in a query layer where failure does not block telemetry ingestion.

GeoIP enrichment and the ASN gap

The geoip processor is the existing specialized lookup processor for IP addresses. It is alpha for traces, metrics, and logs, and the status table lists it in the contrib distribution. It reads an IP address from configured attributes, looks it up through a provider, and writes geographic attributes such as geo.city_name, geo.country.iso_code, geo.region_name, and latitude/longitude fields.

A record-level GeoIP config looks like this:

processors:
geoip/client_city:
providers:
maxmind:
database_path: /etc/otel/GeoLite2-City.mmdb
context: record
attributes: [client.address, source.address]
error_mode: ignore

Set error_mode: ignore or silent if lookup misses should not stop the pipeline. The default is propagate, which can halt processing of the telemetry item on lookup errors.

The important limitation is MaxMind database type support. The MaxMind provider README says it supports GeoIP2-City and GeoLite2-City databases. An open upstream issue requests support for MaxMind ASN, connection type, organization, and network data. So if you need autonomous_system.number or connection-type enrichment, the current GeoIP processor does not provide it through the built-in MaxMind provider.

That limit is easy to miss during migrations from richer log shippers. City-level geolocation is not the same as network intelligence. Treat ASN enrichment as a separate requirement, not as something implied by geoip.

How to design static reference-data lookups

Static lookup tables are the safest place to start because they are bounded and testable. They work well when the key space is small and changes on human timescales.

Good candidates:

  • service.name to owning team
  • k8s.cluster.name to business unit
  • store_id to region or store type
  • deployment.environment aliases
  • partner IDs to coarse partner category
  • hostnames to platform tier

Poor candidates:

  • request IDs
  • session IDs
  • user IDs with millions of values
  • customer IDs that change on every request path
  • values that require a strongly consistent business database read

Keep the destination attributes low-cardinality unless your backend is designed for high-cardinality labels. If customer_id is already high-cardinality, mapping it to customer.name may make the problem easier to read and harder to store. Prefer coarser attributes such as customer.tier, account.segment, or support.plan when those answer the operational question.

Also version the table. Put a lookup.version resource attribute on the Collector or add a comment and release process around the mounted file. When a dashboard changes after a table reload, you want to know whether the signal changed or the mapping changed.

For CSV reloads, write the file atomically: write a new file next to it, then rename it into place. The CSV source README calls this out because a periodic reload should never read a half-written table.

How to design live lookups without breaking the telemetry path

Live lookup enrichment is tempting because it centralizes context. It is also where pipelines become fragile. Every extra dependency in the Collector path can turn an application debugging tool into another production dependency.

Use this rule of thumb: if losing the lookup result should not lose the log, the lookup must have a default and a timeout. If losing the lookup result should lose the log, ask why that decision belongs in the telemetry path.

For a live lookup source, define these settings before writing code:

Design choiceSafer defaultWhy it matters
TimeoutLow hundreds of milliseconds or lessThe Collector processes batches, not one request at a time
Cache TTLLong enough to cover hot keysPrevents repeated calls for the same key
Negative TTLEnabledStops missing keys from hammering the source
Failure modeFail open with defaults for logsPreserves telemetry during dependency failure
ConcurrencyBoundedProtects the lookup service and the Collector
MetricsLatency, hit rate, miss rate, timeout count, fallback countMakes enrichment visible as a pipeline component

This is where OTel Collector monitoring becomes part of the enrichment design. A lookup processor without self-observability can silently turn into a latency sink. Watch receiver accepted counts, processor failures, exporter queue growth, and any lookup-source metrics your custom source emits.

For most teams, the first production version should be static files plus DNS, not HTTP. Move to remote sources only after you have measured how much static lookup already solves.

Pipeline placement and fleet standardization

Enrichment placement depends on who needs the new attribute.

If routing, tail sampling, or filtering uses the enriched attribute, run enrichment before those processors. If only the backend UI needs it, enrichment can run later, after filters remove obvious noise. Keep memory_limiter early and batch late.

A common gateway order looks like this:

service:
pipelines:
logs:
receivers: [otlp]
processors:
- memory_limiter
- filter/drop_noise
- transform/normalize
- lookup/service_owner
- geoip/client_city
- batch
exporters: [otlp]

For traces, be careful with tail sampling. If a tail sampling policy needs team.owner or service.tier, enrich before tail_sampling. If you only want attributes on stored traces, enrich after the sampling decision to reduce lookup work. That tradeoff is workload-specific.

Standardization across clusters is the other half of the problem. A common question from teams running Collectors across many clusters is how to keep sampling and enrichment rules consistent. The fix is not a single processor. It is config ownership:

  1. Keep shared processors in a versioned module or generated config fragment.
  2. Test the config against sample telemetry before rollout.
  3. Validate the exact Collector binary you run, because component availability differs by distribution.
  4. Roll out by cluster and watch Collector metrics during the change.
  5. Keep table files and Collector config in the same release process when one depends on the other.

If you use Last9, the Control Plane can drop, remap, redact, forward, and aggregate telemetry at ingest, before storage, and previews every rule against live data before you save it. That helps when the standardization point is the backend ingest layer rather than each Collector config. For Collector-side transforms that must happen before export, keep those rules in code review with the rest of the Collector deployment.

When to build, wait, or keep enrichment outside the Collector

Build on the alpha lookup processor when the lookup is local, bounded, and worth the custom distribution. Service ownership from YAML or CSV is a good example. So is DNS when you accept DNS timeout and cache behavior.

Wait when your requirement is close to the public roadmap but not urgent. ASN support in the GeoIP processor is a good example: the need is visible upstream, but the current MaxMind provider still documents City databases only.

Keep enrichment outside the Collector when it needs business-transaction consistency, slow APIs, or large per-customer tables. The Collector is a telemetry pipeline, not a request-time business data joiner. If the enrichment source has its own paging, retries, schema migration, and authorization model, the application or a downstream analytics layer is usually a better place to join it.

The useful middle ground is to emit stable join keys and enrich later. Add customer.id, store.id, or tenant.id carefully, then decide which low-cardinality lookup results belong in the hot path.

Checklist for production log enrichment

Use this before you add lookup enrichment to a Collector fleet:

  • The lookup key is present, bounded, and documented.
  • The destination attributes use names that match your schema.
  • Misses have explicit defaults where logs should continue.
  • YAML or CSV files reload on a known interval, or require an explicit rollout.
  • Reload failures emit metrics or logs you alert on.
  • DNS or custom remote lookups have timeout and cache settings.
  • Pipeline order is tied to the downstream decision that needs the enriched field.
  • You tested against sample logs, traces, and metrics from more than one cluster.
  • You verified component availability in the exact distribution you deploy.
  • You version-stamped the config because alpha processors can change.

Log enrichment is useful when it makes telemetry easier to route, sample, query, and own. It becomes risky when it hides a dependency in the path between your services and your observability backend. Start with transform, static lookup, and GeoIP where it fits. Treat live lookups as code, not as a YAML convenience.

FAQ

Does the OpenTelemetry Collector have a lookup processor?

Yes. The lookup processor is alpha for logs, traces, and metrics, and it can use OTTL keys with YAML, CSV, and DNS sources. Its distribution list is empty, so it is not in the official contrib or Kubernetes builds checked on December 2, 2026. Use a custom Collector build if you want to run it today.

Can the GeoIP processor enrich telemetry with ASN data?

Not with the current MaxMind provider checked on December 2, 2026. The GeoIP processor is alpha and ships in the contrib distribution, but the MaxMind provider documents support for GeoIP2-City and GeoLite2-City databases only. ASN, connection type, organization, and network database support remain an open request upstream.

Should live API lookups run inside the Collector?

Usually no, unless the lookup is fast, cached, bounded, observable, and safe to skip on failure. A slow business API can turn the Collector into a dependency for the telemetry path. Keep high-latency lookups outside the hot path or build a custom source with strict timeouts and fallback behavior.

Where should enrichment sit in an OpenTelemetry Collector pipeline?

Put deterministic enrichment after memory limiting and filtering, and before routing, sampling, and backend export when downstream decisions need the new attributes. Keep batch late in the pipeline. Validate this order with sample telemetry because alpha lookup behavior and processor config can change.

Last9 logo and enter key

See Last9 in action.

OpenTelemetry · Prometheus

Just update your config. Start seeing data on Last9 in seconds.

Datadog · New Relic · Others

We've got you covered. Bring over your dashboards & alerts in one click.

Built on Open Standards

100+ integrations. OTel native, works with your existing stack.