Skip to content

Commit

Permalink
add: elk env
Browse files Browse the repository at this point in the history
  • Loading branch information
trend-andy-pan committed Sep 26, 2019
1 parent 13a4223 commit 009629c
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ELK/logstash/config/logstash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
## Default Logstash configuration from logstash-docker.
## from https://github.com/elastic/logstash-docker/blob/master/build/logstash/config/logstash-oss.yml
#
http.host: "example-logstash"
path.config: /usr/share/logstash/pipeline
1 change: 1 addition & 0 deletions ELK/logstash/inputFile/log-2019-09-26.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[2019-09-16 07:49:14] Docker-ELKonLaravel.INFO: Hello Word!
32 changes: 32 additions & 0 deletions ELK/logstash/pipeline/logstash.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
input {
tcp {
port => 5000
}

file {
type => "inputFile"
path => "/home/inputFile/log-*"
start_position => "beginning"
}
}

filter {
json {
source => "message"
remove_field => ["message"]
}
grok {
match => {
"message" =>
"\[%{TIMESTAMP_ISO8601:date}\] %{DATA:env}\.%{DATA:level}: %{GREEDYDATA:info}"
}
remove_field => ["message"]
}
}

output {
elasticsearch {
hosts => "${ES_HOST}:9200"
index => "example-elk"
}
}
51 changes: 50 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,63 @@ services:
container_name: ${APP_NAME}
hostname: ${APP_NAME}
networks:
- LAN
- LAN
build:
context: ./
dockerfile: Dockerfile
args:
- LS_HOST=${LS_HOST}:${LS_PORT1}
ports:
- ${APP_PORT}:8080
volumes:
- ./:/var/www/html/
depends_on:
- logstash

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
container_name: ${ES_HOST}
hostname: ${ES_HOST}
ports:
- "${ES_PORT1}:9200"
- "${ES_PORT2}:9300"
environment:
ES_JAVA_OPTS: "-Xms256m -Xmx256m"
networks:
- LAN

logstash:
image: docker.elastic.co/logstash/logstash:${ELK_VERSION}
container_name: ${LS_HOST}
hostname: ${LS_HOST}
ports:
- "${LS_PORT1}:5000"
- "${LS_PORT2}:9600"
depends_on:
- elasticsearch
environment:
LS_JAVA_OPTS: "-Xms256m -Xmx256m"
ES_HOST: ${ES_HOST}
volumes:
- ./ELK/logstash/pipeline:/usr/share/logstash/pipeline:ro
- ./ELK/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
- ./ELK/logstash/inputFile/:/home/inputFile
networks:
- LAN

kibana:
image: docker.elastic.co/kibana/kibana:${ELK_VERSION}
container_name: ${KB_HOST}
hostname: ${KB_HOST}
ports:
- "${KB_PORT}:5601"
depends_on:
- elasticsearch
environment:
SERVER_NAME: ${KB_HOST}
ELASTICSEARCH_URL: http://${ES_HOST}:${ES_PORT1}
networks:
- LAN

networks:
LAN:
Expand Down

0 comments on commit 009629c

Please sign in to comment.