有哪些功能

- APM: Application Performance Monitor
- SIEM: Security Information and Event Management
ELK
- logz.io/learn/complete-guide-elk-stack/
- used for
- monitoring
- troubleshooting
- securing IT environments
- business intelligence
- web analytics
- history
- Splunk has long been a market leader in the space
- ELK is a simple but robust log management and analytics platform that costs a fraction of the price.
- Elasticsearch
- an open source, full-text search and analysis engine, based on the Apache Lucene search engine
- 特性
- NoSQL
- REST API
- 概念
- Index 索引
- Document 文档,JSON 格式
_index_type_id_version
- Type 类型,文档的子分类,对应文档的元数据字段
_type,由名字和一个映射(mapping)组成 - Mapping 映射,类似于关系数据库的 Schema,定义了一个索引内不同的类型。具体定义了文档的一些字段名以及类型,和索引存储方式
- Shards 分片
- Elasticsearch 软件崩溃的最常见原因是索引数据量太大
- 通过数据分片减小单点压力并提高分析性能
- Replicas,复制
- 分片的拷贝
- 用于从节点挂掉或网络中断故障中恢复
- 保证高可用性
- Elasticsearch Queries, ES 查询
- 使用 Lucene 的语法
- 查询语法
- 逻辑操作:
AND,OR,NOT - 字段查询:
name:"Nerd Stark" - 范围查询:
age:[3 TO 10](闭区间),price:{100 TO 400}(开区间),name:[Adam TO Ziggy] - Widcards:
Ma?s,Ma*s - 正则查询:
/p[ea]n/,/<.+>/ - 模糊搜索
blow~->["blew", "brow", "glow"]- 指定词间距:
john~2->["jean", "johns", "jhon", "horn"]
- 自由文本(Free Text):匹配字段名或字段值等
- 组合查询:
mustmust_notshouldfilter:通过布尔类型的判断结果来过滤- Queries:通过整数类型的求职结果来过滤
- 可通过接口查询
curl "localhost:9200/_search?q=name:travis" - Query DSL | Elasticsearch Reference [7.7]
- Elasticsearch Query: A Thorough Guide to Lucene Query Syntax
- 逻辑操作:
- 接口分类
- Document API
- Search API
- Indices API
- Cluster API
- 插件
- core plugins
- API Extension
- Alerting
- Analysis
- Discovery
- Ingest
- Management
- Mapper
- Security
- Snapshot / Restore
- Store
- community plugins
- core plugins
- 使用误区 -> The Top 5 Elasticsearch Mistakes & How to Avoid Them
- 未定义索引 mapping
- 组合查询编写不当导致复杂度爆表
- 生产环境配置不当,比如集群名称、节点名称、集群节点数、允许的恢复时间、集群主节点选取的投票半数数量
- 硬件容量配置,应当采取
start big and scale down的策略 - mapping 模板过大,会造成性能下降
- Logstash
- a log aggregator that collects data from various input sources, executes different transformations and enhancements and then ships the data to various supported output destinations
- Kibana
- visualization layer that works on top of Elasticsearch, providing users with the ability to analyze and visualize the data
- Beats
- lightweight agents that are installed on edge hosts to collect different types of data for forwarding into the stack
- used for


本地安装试用
通过已有的 docker-compose 模板 deviantony/docker-elk
git clone https://github.com/deviantony/docker-elk.git
cd docker-elk
docker-compose up -d
然后,根据 deviantony/docker-elk #initial-setup 初始化内置用户,导入日志数据,配置 kibana 索引模式。
手动安装
通过 docker 安装。
docker run -d \
--name es \
-p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
docker.elastic.co/elasticsearch/elasticsearch:7.7.1
略
生产级部署
- 涉及到这些问题
- 多个 Elastichsearch 节点
- 可能多个 Logstash 节点
- 跨区域或数据中心内多个点的数据复制
- 警报插件
- 高可用