Elasticsearch,Filebeat,Kibana部署,添加图表及elastalert报警
服务端安装
Elasticsearch和Kibana(需要安装openjdk1.8以上)
安装方法:https://www.elastic.co
以Ubuntu为例:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
apt-get update
apt-get install elasticsearch
apt-get install kibana
elasticsearch配置
cat /etc/elasticsearch/elasticsearch.yml
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 172.16.80.28
http.port: 9200
discovery.zen.ping.unicast.hosts: ["172.16.80.28","172.16.80.155"]
附件有文件elasticsearch.map
Kibana配置
cat /etc/kibana/kibana.yml
server.port: 5601
server.host: "172.16.80.28"
elasticsearch.url: "http://172.16.80.28:9200"
Elastalert(需要Python2.7)
下载 https://github.com/Yelp/elastalert/releases
进入elastalert目录
pip install -r requirements.txt
python setup.py install
elastalert-create-index
前台运行elastalert
python -m elastalert.elastalert --verbose --rule rules/my_rule.yaml
安装参考:
https://elastalert.readthedocs.io/en/latest/running_elastalert.html#downloading-and-configuring
https://blog.csdn.net/df007df/article/details/54773391
elastalert配置
cat /etc/elastalert/rules/my_rule.yaml
es_host: 172.16.80.28
es_port: 9200
name: filebeat rules
type: frequency
index: filebeat*
num_events: 5
timeframe:
hours: 1
filter:
- query:
query_string:
query: "message: *error*"
alert:
- "email"
email:
- "aaa@qq.com"
- "bbb@qq.com"
alert_text: "Ref Log http://172.16.80.28:5601/app/kibana"
smtp_host: smtp.exmail.qq.com
smtp_port: 25
smtp_ssl: false
smtp_auth_file: /etc/elastalert/rules/smtp_auth_file.yaml
from_addr: aaa@qq.com
cat /etc/elastalert/rules/smtp_auth_file.yaml
user: "aaa@qq.com"
password: "邮箱密码"
cat /etc/elastalert/config.yaml
rules_folder: /etc/elastalert/rules
run_every:
minutes: 1
buffer_time:
minutes: 15
es_host: 172.16.80.28
es_port: 9200
s_url_prefix: elasticsearch
writeback_index: elastalert_status
alert_time_limit:
days: 2
elastalert配置注解
rules_folder:用来加载下一阶段rule的设置,默认是example_rules
run_every:用来设置定时向elasticsearch发送请求
buffer_time:用来设置请求里时间字段的范围,默认是45分钟
es_host:elasticsearch的host地址
es_port:elasticsearch 对应的端口号
use_ssl:可选的,选择是否用SSL连接es,true或者false
es_username:es认证的username
es_password:es认证的password
writeback_index:elastalert产生的日志在elasticsearch中的创建的索引
alert_time_limit:失败重试的时间限制
告警参考
https://blog.csdn.net/gamer_gyt/article/details/52917116
https://elastalert.readthedocs.io/en/latest/ruletypes.html
客户端安装
Filebeat安装
以Ubuntu为例:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
apt-get update
apt-get install filebeat
filebeat配置
cat /etc/filebeat/filebeat.yml
filebeat.prospectors:
- type: log
enabled: true
paths:
- /var/log/nginx/*.log
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 3
setup.kibana:
host: "172.16.80.28:5601"
output.elasticsearch:
hosts: ["172.16.80.28:9200"]
EFK备注
日志位置 /var/lib/elasticsearch/nodes/
日志大小 暂时为345Mb
日志轮循 暂时不知道在哪设置
elasticsearch.map内容:
# uint mapping
{
"settings" : {
"index" : {
"number_of_replicas" : ,
"number_of_shards" :
}
},
"mappings" : {
"values" : {
"properties" : {
"itemid" : {
"type" : "long"
},
"clock" : {
"format" : "epoch_second",
"type" : "date"
},
"value" : {
"type" : "long"
}
}
}
}
} # dbl mapping
{
"settings" : {
"index" : {
"number_of_replicas" : ,
"number_of_shards" :
}
},
"mappings" : {
"values" : {
"properties" : {
"itemid" : {
"type" : "long"
},
"clock" : {
"format" : "epoch_second",
"type" : "date"
},
"value" : {
"type" : "double"
}
}
}
}
} # str mapping
{
"settings" : {
"index" : {
"number_of_replicas" : ,
"number_of_shards" :
}
},
"mappings" : {
"values" : {
"properties" : {
"itemid" : {
"type" : "long"
},
"clock" : {
"format" : "epoch_second",
"type" : "date"
},
"value" : {
"fields" : {
"analyzed" : {
"index" : true,
"type" : "text",
"analyzer" : "standard"
}
},
"index" : false,
"type" : "text"
}
}
}
}
} # text mapping
{
"settings" : {
"index" : {
"number_of_replicas" : ,
"number_of_shards" :
}
},
"mappings" : {
"values" : {
"properties" : {
"itemid" : {
"type" : "long"
},
"clock" : {
"format" : "epoch_second",
"type" : "date"
},
"value" : {
"fields" : {
"analyzed" : {
"index" : true,
"type" : "text",
"analyzer" : "standard"
}
},
"index" : false,
"type" : "text"
}
}
}
}
} # log mapping
{
"settings" : {
"index" : {
"number_of_replicas" : ,
"number_of_shards" :
}
},
"mappings" : {
"values" : {
"properties" : {
"itemid" : {
"type" : "long"
},
"clock" : {
"format" : "epoch_second",
"type" : "date"
},
"value" : {
"fields" : {
"analyzed" : {
"index" : true,
"type" : "text",
"analyzer" : "standard"
}
},
"index" : false,
"type" : "text"
}
}
}
}
}
Elasticsearch,Filebeat,Kibana部署,添加图表及elastalert报警的更多相关文章
- elasticsearch+logstash+kibana部署
这篇博客讲的是elasticsearch+logstash+kibana部署的方法. 内容大纲: 1.elasticsearch+logstash+kibana部署 2.收集Tomcat日志 3.收集 ...
- EFK(Elasticsearch+Filebeat+Kibana)收集容器日志
介绍 Elasticsearch 是一个实时的.分布式的可扩展的搜索引擎,允许进行全文.结构化搜索,它通常用于索引和搜索大量日志数据,也可用于搜索许多不同类型的文档. Beats 是数据采集的得力工具 ...
- ELK (Elasticsearch+Logstash+Kibana)部署
部署机器: 服务端:dev-server X.X.X.X ( logstash-1.5.4,elasticsearch-1.7.1,kibana-4.1.1 ) 客户端:dev-cli ...
- elasticsearch+filebeat+kibana提取多行日志
filebeat的配置文件filebeat.yml以下三行去掉注释 multiline.pattern: ^\[ multiline.negate: true //false改为true multil ...
- ELK( ElasticSearch+ Logstash+ Kibana)分布式日志系统部署文档
开始在公司实施的小应用,慢慢完善之~~~~~~~~文档制作 了好作运维同事之间的前期普及.. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 软件下载地址: https://www.e ...
- ELK 架构之 Elasticsearch、Kibana、Logstash 和 Filebeat 安装配置汇总(6.2.4 版本)
相关文章: ELK 架构之 Elasticsearch 和 Kibana 安装配置 ELK 架构之 Logstash 和 Filebeat 安装配置 ELK 架构之 Logstash 和 Filebe ...
- (1)ElasticSearch搭配Kibana在linux环境的部署
1.简介 这个章节主要介绍ElasticSearch+Kibana两个组件在linux环境的部署步骤,以及在部署过程中遇到问题解决,暂就不涉及集群部署知识点,后面章节再详细讲解这块.下面让我们来简单了 ...
- ElasticSearch+Logstash+Filebeat+Kibana集群日志管理分析平台搭建
一.ELK搜索引擎原理介绍 在使用搜索引擎是你可能会觉得很简单方便,只需要在搜索栏输入想要的关键字就能显示出想要的结果.但在这简单的操作背后是搜索引擎复杂的逻辑和许多组件协同工作的结果. 搜索引擎的组 ...
- ELK6.0部署:Elasticsearch+Logstash+Kibana搭建分布式日志平台
一.前言 1.ELK简介 ELK是Elasticsearch+Logstash+Kibana的简称 ElasticSearch是一个基于Lucene的分布式全文搜索引擎,提供 RESTful API进 ...
随机推荐
- swoole使用异步进程通信
$process = new swoole_process(function($pro){ $pro->exec('//linux中的php命令所在绝对路径', ['//执行文件绝对路径']); ...
- coursera课程视频
#!/usr/bin/env python # coding=utf-8 import urllib import urllib2 import cookielib def setcookie(ena ...
- cf F. Shovels Shop
https://codeforces.com/contest/1154/problem/F 给定m个折扣 每个折扣的{x,y}的意思是每次购买如果买到确切的x只铲子就其中的最便宜的y只铲子免付: 先贪 ...
- NLP-文本分类之开始(0)
转眼读研一年了,开题也开了,方向也定了,大方向就是NLP,然而从一开始的上课.做项目开题什么的(自己也比较贪玩,以前不打游戏,结果王者上瘾了),到现在对NLP是一知半解,不对,半解都没有半解,然后时间 ...
- [LC] 1048. Longest String Chain
Given a list of words, each word consists of English lowercase letters. Let's say word1 is a predece ...
- bind() 方法
一. 定义和用法 bind() 方法为被选元素添加一个或多个事件处理程序,并规定事件发生时运行的函数. 语法: $(selector).bind(event,data,function) 举例:
- iOS性能检测工具instrunments简单介绍
1.前提条件 在appstore中下载安装xcode 2.打开方式 3.页面元素介绍 3.电脑连接手机选中要测试的app 4.选中要测试哪项,双击进去,点击开始进行监控测试 5.主要介绍一下三项 第一 ...
- 《C程序设计语言》练习1-5
#include<stdio.h> /*修改温度转换程序,要求以逆序(即按照从300度到0度的顺序)打印温度转换表*/ main () { float fahr,celsius; int ...
- [LC] 234. Palindrome Linked List
Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false ...
- 4)date中的Ymd格式问题
以下是详细的参数: format 字符 说明 返回值例子日 --- ---d 月份中的第几天,有前导零的 2 位数字 01 到 31D 星期中的第几天,文本表示,3 个字母 Mon 到 Sunj 月份 ...