Prompt

How do I index logs so searches stay fast at high volume?

Technology / Observability1 observationLast seen Oct 28, 2026

Latest observation

Oct 28, 2026OpenAI APIWeb search: off

To keep log search fast at high volume, focus on making queries cheap and keeping the index small, ordered, and time-based.

Core principles

1) Index only what you actually search

Don’t blindly index every field.

Good candidates:

  • timestamp
  • service / app
  • environment
  • host
  • level (info, error, etc.)
  • trace_id / request_id
  • key error codes or status fields

Usually don’t index:

  • full log message text
  • large payloads
  • high-cardinality free-form fields unless needed
  • fields you never filter on

If you use Elasticsearch/OpenSearch, mark many fields as doc_values-only or not indexed at all when appropriate.


2) Use time-based partitioning

Logs are almost always searched by time range, so split data by time:

  • daily or hourly indices / partitions for very large volumes
  • use retention/TTL policies
  • drop old shards/partitions instead of deleting individual records

This reduces the amount of data each query touches.


3) Keep shard/partition sizes reasonable

Too many tiny shards hurt performance; too few huge shards hurt parallelism.

Rule of thumb:

  • aim for shards/partitions that are not too small
  • keep hot shards manageable for your storage and query load
  • scale shard count with ingest/query volume

For Elasticsearch/OpenSearch, a common goal is to avoid lots of tiny shards and keep shard sizes in a healthy range for your workload.


4) Design around common filters

Put the most selective and most common filters into indexed fields:

  • service
  • environment
  • cluster
  • region
  • severity
  • tenant/customer_id if multi-tenant

If most searches are like:

  • “errors from service X in prod last 15 min” then those fields should be indexed and optimized.

5) Use inverted-index-friendly field types

For exact matches and faceting:

  • use keyword / exact string fields
  • use numeric types for codes/timestamps
  • avoid analyzed text fields unless you need full-text search

For message search:

  • consider a separate analyzed field for full-text
  • keep structured fields separate from message text

6) Reduce cardinality where possible

High-cardinality fields can bloat indexes and slow aggregations:

  • request IDs
  • user IDs
  • session IDs
  • unique URLs with query params

Strategies:

  • don’t index them unless needed
  • index a normalized version
  • bucket/normalize values
  • store raw value in source, but not as searchable field

7) Normalize logs at ingest

Parse logs into structured fields at ingestion time:

  • JSON logs are much faster to search than raw text
  • extract level, service, trace_id, etc.
  • strip noisy/unnecessary fields

This turns expensive text searches into fast field filters.


8) Use sampling or tiered storage for very high volume

If volume is extreme:

  • keep full-fidelity logs for recent data
  • downsample older logs
  • move cold data to cheaper storage
  • archive to object storage and query less often

This keeps hot search paths fast.


9) Precompute what you search often

If users often search for the same patterns:

  • build summaries or rollups
  • maintain error counts by service/minute
  • store top exceptions separately

This reduces repeated expensive scans.


10) Tune query patterns

Even with a good index, bad queries are slow:

  • always include a time range
  • prefer exact match filters before full-text search
  • avoid leading wildcards like *error
  • avoid regex on large fields unless necessary
  • paginate efficiently

Practical recipe

If you’re building or tuning a log system:

  1. Store logs in structured JSON
  2. Partition by time
  3. Index only search/filter fields
  4. Use exact-match fields for service/env/level/trace_id
  5. Keep message text searchable, but don’t over-index everything
  6. Apply retention and tiered storage
  7. Monitor shard/index size and query latency
  8. Review real query patterns and adjust mappings accordingly

Common mistakes

  • indexing raw log text plus every JSON field
  • not using time-based indices
  • huge shards with no rollover
  • querying across months of data without filters
  • indexing high-cardinality fields unnecessarily
  • relying on regex for normal searches

If you tell me what stack you’re using—Elasticsearch/OpenSearch, Splunk, Loki, ClickHouse, BigQuery, PostgreSQL, etc.—I can give specific indexing and schema recommendations.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.