fzy-blog

ELK配置

2019-05-24

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
logstash中文文档

https://doc.yonyoucloud.com/doc/logstash-best-practice-cn/filter/date.html



ELK原型与介绍:

http://www.cnblogs.com/aresxin/p/8035137.html



一、logstash配置 http://localhost:9600

sudo rpm -ivh logstash-5.2.2.rpm

# 默认安装在 /usr/share/logstash/

# 配置文件在/etc/logstash/

# 日志文件在/var/log/logstash/

配置监听5044端口:

sudo vi /etc/logstash/conf.d/filebeat_logstash_es.conf

input {

beats {

port => "5044"

}

}

output {

elasticsearch {

hosts => "localhost:9200"

}

}

配置方式一:

input {

file{

path => "/Users/zhaoyang10/Downloads/logs/*.log"

start_position => "beginning"

}

}

output {

elasticsearch {

hosts => "localhost:9200"

index => "logstash-ams-%{+YYYY.MM.dd}"

}

}



测试配置文件是否正确: bin/logstash -f first-pipeline.conf --config.test_and_exit

启动:bin/logstash -f first-pipeline.conf

比较常用的有:

bin/logstash-plugin list #查看已安装插件列表

bin/logstash-plugin install plugin_name #安装插件

bin/logstash-plugin update plugin_name #卸载插件

bin/logstash-plugin uninstall plugin_name #卸载插件

我们通过list命令查看插件列表时候,无非下列三种类型的插件:

logstash-codec-* #编码解码插件

logstash-filter-* #数据处理插件

logstash-input-* #输入插件

logstash-output-* #输出插件



二、filebeat配置

vi /etc/filebeat/filebeat.yml

paths:

- /var/log/host.access.log

output.logstash:

# The Logstash hosts

hosts: ["10.10.36.128:5044"]



三、elastic search 配置 http://localhost:9200

get: http://localhost:9200/test01/_search

delete:http://localhost:9200/test01/doc/_xRJOGUBPpihVJpnsqWC/

put: http://localhost:9200/song001/list001/5

data:{"number":32768,"singer":"杨坤","size":"777","song":"今夜20岁","tag":"中国好声音","timelen":319}



设置密码: bin/x-pack/setup-passwords auto

Changed password for user kibana

PASSWORD kibana = xtTAe0VGCaXfoo9jLGtd

Changed password for user logstash_system

PASSWORD logstash_system = TFxxvbvxgKcHEDbJrlvi

Changed password for user elastic

PASSWORD elastic = u2gxvTsHt8i5APS2F25T



四、kibana 配置 http://localhost:5601

安装x-pack

bin/kibana-plugin install file://你的文件存放地址



es启动命令 9200
./bin/elasticsearch -d

kibana启动命令 5601
./bin/kibana

logstash启动命令 9600
安装 logstash-plugin install logstash-filter-multiline
./bin/logstash -f ./config/logstash_filebeat.conf --config.test_and_exit
./bin/logstash -f ./config/logstash_filebeat.conf --config.reload.automatic

filebeat启动命令 5044
./filebeat -e -c filebeat.yml -d "publish"
使用支付宝打赏
使用微信打赏

若你觉得我的文章对你有帮助,欢迎点击上方按钮对我打赏

扫描二维码,分享此文章