ELK
ELK
install
|
|
get cos to logstash and es by file
|
|
logstash
plugins
|
|
yum -y install libmaxminddb-devel-1.2.0-6.el7.x86_64
debug
https://www.elastic.co/guide/en/logstash/current/running-logstash-command-line.html
通过logstash -f test.conf测试 可能会出现内存不够的情况
grok
grok官方文档 https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html
grok和dessect都可以用于过滤和匹配,对于重复性多的请用dessect grok数据类型
注意
|
|
一个例子,匹配supervsior日志
|
|
dessect
csv
geiop
free geoip
https://mailfud.org/geoip-legacy/
https://github.com/P3TERX/GeoLite.mmdb/releases/tag/2022.06.10
http x-forwarded-for to real ip
|
|
Kibana
https://www.elastic.co/guide/cn/kibana/current/index.html
KQL
官方文档建议通读 https://www.elastic.co/guide/en/kibana/current/kuery-query.html
首先kql 不能进行排序和聚合
, 仅能用于过滤数据
,kql 不支持正则
条件查询
|
|
与或非
|
|
范围查询
>=, > , < , <=
|
|
时间查询
|
|
检查字段是否存在
存在 your_field:*
|
|
通配符匹配
|
|
嵌套字段的匹配
假设有一个字段是
|
|
匹配score>=60的name
|
|
save query to csv
share your query first, click generate csv
management - reports
download
canvas
https://www.elastic.co/guide/en/kibana/current/canvas.html 可以绘制更好看自定义级别更高的图表
export visualizations
management –> saved objects –> export
management –> saved objects –> import
FAQ
重新映射timestamp
|
|
logstash里面的timestamp
https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html
es每日index
|
|
丢掉部分无用message
|
|
打开xpack
https://www.elastic.co/cn/what-is/open-x-pack
https://linuxhint.com/enable-xpack-elasticsearch/
自动追加timestamp
|
|
|
|
多个elasticsearch index拼接成一个index
|
|
把shell带换行的内容带到es里面去
假设是一个traceroute的结果
|
|
主要任务是主要是把换行改成\n字符串就好了
setting 'filebeat.prospectors' has been removed
change to filebeat.inputs