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.
More on Logging: ELK/EFK, Loki & Log Shippers
What is the ELK stack, and what is EFK?BeginnerWhat is ILM (Index Lifecycle Management) and why do log clusters need it?IntermediateWhat is an Elasticsearch data stream?AdvancedWhat is an index template and mapping, and what is a mapping explosion?AdvancedWhat does Logstash do compared with Beats?IntermediateWhat is Grafana Loki and how is it different from Elasticsearch?Beginner