Add ELK stack
This commit is contained in:
parent
621e48fe33
commit
6515fde455
6
Makefile
6
Makefile
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
run:
|
run:
|
||||||
@docker-app render | docker-compose -f - up -d --build && docker logs docker_hello_1 -f
|
@docker-app render | docker-compose -f - up -d --build && docker logs hello -f
|
||||||
|
|
||||||
rm:
|
rm:
|
||||||
@docker rm -f $$(docker ps -a --format="{{.Names}}")
|
@docker rm -f $$(docker ps -a --format="{{.Names}}")
|
||||||
@ -13,3 +13,7 @@ put:
|
|||||||
|
|
||||||
del:
|
del:
|
||||||
@etcdctl del /dev/etcd/loaded
|
@etcdctl del /dev/etcd/loaded
|
||||||
|
|
||||||
|
|
||||||
|
status:
|
||||||
|
curl http://127.0.0.1:9200/_cat/health
|
||||||
|
@ -7,6 +7,7 @@ services:
|
|||||||
args:
|
args:
|
||||||
httpEchoServerVersion: ${image-version}
|
httpEchoServerVersion: ${image-version}
|
||||||
alpineVersion: ${alpine-version}
|
alpineVersion: ${alpine-version}
|
||||||
|
container_name: hello
|
||||||
environment:
|
environment:
|
||||||
HTTPTEXT: ${response-text}
|
HTTPTEXT: ${response-text}
|
||||||
# etcdWait parameter
|
# etcdWait parameter
|
||||||
@ -17,14 +18,69 @@ services:
|
|||||||
- ${echo-port}:5678
|
- ${echo-port}:5678
|
||||||
|
|
||||||
etcd:
|
etcd:
|
||||||
|
container_name: etcd
|
||||||
image: bitnami/etcd
|
image: bitnami/etcd
|
||||||
environment:
|
environment:
|
||||||
- ALLOW_NONE_AUTHENTICATION=yes
|
- ALLOW_NONE_AUTHENTICATION=yes
|
||||||
# - ETCD_ADVERTISE_CLIENT_URLS=http://0.0.0.0:2379
|
# - ETCD_ADVERTISE_CLIENT_URLS=http://0.0.0.0:2379
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "2379:2379/tcp"
|
- ${etcd-port}:2379/tcp
|
||||||
|
|
||||||
|
elasticsearch:
|
||||||
|
image: docker.elastic.co/elasticsearch/elasticsearch:${elk-version}
|
||||||
|
container_name: elasticsearch
|
||||||
|
environment:
|
||||||
|
- cluster.name=docker-cluster
|
||||||
|
- bootstrap.memory_lock=true
|
||||||
|
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||||
|
ulimits:
|
||||||
|
memlock:
|
||||||
|
soft: -1
|
||||||
|
hard: -1
|
||||||
|
volumes:
|
||||||
|
- esdata1:/usr/share/elasticsearch/data
|
||||||
|
ports:
|
||||||
|
- ${es-port}:9200
|
||||||
|
networks:
|
||||||
|
- esnet
|
||||||
|
|
||||||
|
logstash:
|
||||||
|
image: docker.elastic.co/logstash/logstash:${elk-version}
|
||||||
|
container_name: logstash
|
||||||
|
environment:
|
||||||
|
XPACK_MONITORING_ELASTICSEARCH_URL: http://elasticsearch:9200
|
||||||
|
volumes:
|
||||||
|
- pipelines:/usr/share/logstash/pipeline/
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
depends_on:
|
||||||
|
- elasticsearch
|
||||||
|
networks:
|
||||||
|
- esnet
|
||||||
|
|
||||||
|
kibana:
|
||||||
|
image: docker.elastic.co/kibana/kibana:${elk-version}
|
||||||
|
container_name: kibana
|
||||||
|
environment:
|
||||||
|
SERVER_NAME: local.localhost.com
|
||||||
|
ELASTICSEARCH_HOSTS: http://elasticsearch
|
||||||
|
ports:
|
||||||
|
- ${kibana-port}:5601
|
||||||
|
depends_on:
|
||||||
|
- elasticsearch
|
||||||
|
networks:
|
||||||
|
- esnet
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
data-volume:
|
data-volume:
|
||||||
driver: local
|
driver: local
|
||||||
|
esdata1:
|
||||||
|
driver: local
|
||||||
|
pipelines:
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
device: $$PWD/test.dockerapp/logstash/pipelines/
|
||||||
|
o: bind
|
||||||
|
networks:
|
||||||
|
esnet:
|
||||||
|
14
test.dockerapp/logstash/pipelines/elasticsearch.conf
Normal file
14
test.dockerapp/logstash/pipelines/elasticsearch.conf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
input {
|
||||||
|
beats {
|
||||||
|
port => 5044
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
elasticsearch {
|
||||||
|
hosts => "elasticsearch:9200"
|
||||||
|
manage_template => false
|
||||||
|
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
|
||||||
|
document_type => "%{[@metadata][type]}"
|
||||||
|
}
|
||||||
|
}
|
9
test.dockerapp/logstash/pipelines/stdin.conf
Normal file
9
test.dockerapp/logstash/pipelines/stdin.conf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
input {
|
||||||
|
stdin { }
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
elasticsearch {
|
||||||
|
hosts => ["elasticsearch:9200"]
|
||||||
|
}
|
||||||
|
}
|
30
test.dockerapp/logstash/pipelines/telnet.conf
Normal file
30
test.dockerapp/logstash/pipelines/telnet.conf
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
input {
|
||||||
|
tcp {
|
||||||
|
port => 5000
|
||||||
|
type => syslog
|
||||||
|
}
|
||||||
|
udp {
|
||||||
|
port => 5000
|
||||||
|
type => syslog
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
filter {
|
||||||
|
if [type] == "syslog" {
|
||||||
|
grok {
|
||||||
|
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
|
||||||
|
add_field => [ "received_at", "%{@timestamp}" ]
|
||||||
|
add_field => [ "received_from", "%{host}" ]
|
||||||
|
}
|
||||||
|
date {
|
||||||
|
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
elasticsearch {
|
||||||
|
hosts => ["elasticsearch:9200"]
|
||||||
|
}
|
||||||
|
stdout { codec => rubydebug }
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
echo-port: 5678
|
echo-port: 5678
|
||||||
etcd-port: 2379
|
etcd-port: 2379
|
||||||
|
es-port: 9200
|
||||||
|
kibana-port: 5601
|
||||||
|
|
||||||
etcdWait-platform: dev
|
etcdWait-platform: dev
|
||||||
etcdWait-max-retry: 100
|
etcdWait-max-retry: 100
|
||||||
@ -11,3 +13,4 @@ etcdApiVersion: 3.3
|
|||||||
etcd-version: 3.3.11
|
etcd-version: 3.3.11
|
||||||
image-version: latest
|
image-version: latest
|
||||||
alpine-version: 3.7
|
alpine-version: 3.7
|
||||||
|
elk-version: 6.6.0
|
Loading…
Reference in New Issue
Block a user