Interview Prep/Monitoring & Observability/Logging: ELK/EFK, Loki & Log Shippers

How does Elasticsearch store and search logs?

IntermediateConceptLogging: ELK/EFK, Loki & Log Shippers
Answer

Each log is a JSON document in an index. Indexes are split into primary shards (each a Lucene index) with replica shards on other nodes. Text fields are analyzed into an inverted index (term to document list), which makes full-text search fast; keyword fields support exact match and aggregations.

Documents are written to an in-memory buffer and become searchable after a refresh (default 1s), giving near-real-time search. The cost is that the full-text index is often as large as the raw data.

All Monitoring & Observability questions Roadmap: Logging & tracing

More on Logging: ELK/EFK, Loki & Log Shippers