allow logstash plugin management

This commit is contained in:
Anthony Lapenna 2016-07-07 10:08:50 +12:00
parent b14907d33a
commit 890c3959e6
4 changed files with 27 additions and 11 deletions

View File

@ -67,8 +67,7 @@ And then access Kibana UI by hitting [http://localhost:5601](http://localhost:56
* user: *elastic* * user: *elastic*
* password: *changeme* * password: *changeme*
*NOTE*: You'll need to inject data into logstash before being able to create a logstash index in Kibana. Then all you should have to do is to *NOTE*: You'll need to inject data into logstash before being able to create a logstash index in Kibana. Then all you should have to do is to hit the create button.
hit the create button.
See: https://www.elastic.co/guide/en/kibana/current/setup.html#connect See: https://www.elastic.co/guide/en/kibana/current/setup.html#connect
@ -105,8 +104,8 @@ If you want to override the default configuration, add the *LS_HEAP_SIZE* enviro
```yml ```yml
logstash: logstash:
image: logstash:latest build: logstash/
command: logstash -f /etc/logstash/conf.d/logstash.conf command: -f /etc/logstash/conf.d/
volumes: volumes:
- ./logstash/config:/etc/logstash/conf.d - ./logstash/config:/etc/logstash/conf.d
ports: ports:
@ -117,6 +116,13 @@ logstash:
- LS_HEAP_SIZE=2048m - LS_HEAP_SIZE=2048m
``` ```
## How can I add Logstash plugins? ##
To add plugins to logstash you have to:
1. Add a RUN statement to the `logstash/Dockerfile` (ex. `RUN logstash-plugin install logstash-filter-json`)
2. Add the associated plugin code configuration to the `logstash/config/logstash.conf` file
## How can I enable a remote JMX connection to Logstash? ## How can I enable a remote JMX connection to Logstash?
As for the Java heap memory, another environment variable allows to specify JAVA_OPTS used by Logstash. You'll need to specify the appropriate options to enable JMX and map the JMX port on the docker host. As for the Java heap memory, another environment variable allows to specify JAVA_OPTS used by Logstash. You'll need to specify the appropriate options to enable JMX and map the JMX port on the docker host.
@ -125,13 +131,12 @@ Update the container in the `docker-compose.yml` to add the *LS_JAVA_OPTS* envir
```yml ```yml
logstash: logstash:
image: logstash:latest build: logstash/
command: logstash -f /etc/logstash/conf.d/logstash.conf command: -f /etc/logstash/conf.d/
volumes: volumes:
- ./logstash/config:/etc/logstash/conf.d - ./logstash/config:/etc/logstash/conf.d
ports: ports:
- "5000:5000" - "5000:5000"
- "18080:18080"
links: links:
- elasticsearch - elasticsearch
environment: environment:
@ -149,9 +154,11 @@ Then, you'll need to map your configuration file inside the container in the `do
```yml ```yml
elasticsearch: elasticsearch:
build: elasticsearch/ build: elasticsearch/
command: elasticsearch -Des.network.host=_non_loopback_
ports: ports:
- "9200:9200" - "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xms1g -Xmx1g"
volumes: volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
``` ```
@ -164,6 +171,9 @@ elasticsearch:
command: elasticsearch -Des.network.host=_non_loopback_ -Des.cluster.name: my-cluster command: elasticsearch -Des.network.host=_non_loopback_ -Des.cluster.name: my-cluster
ports: ports:
- "9200:9200" - "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xms1g -Xmx1g"
``` ```
# Storage # Storage
@ -177,9 +187,11 @@ In order to persist Elasticsearch data even after removing the Elasticsearch con
```yml ```yml
elasticsearch: elasticsearch:
build: elasticsearch/ build: elasticsearch/
command: elasticsearch -Des.network.host=_non_loopback_
ports: ports:
- "9200:9200" - "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xms1g -Xmx1g"
volumes: volumes:
- /path/to/storage:/usr/share/elasticsearch/data - /path/to/storage:/usr/share/elasticsearch/data
``` ```

View File

@ -6,7 +6,7 @@ elasticsearch:
environment: environment:
ES_JAVA_OPTS: "-Xms1g -Xmx1g" ES_JAVA_OPTS: "-Xms1g -Xmx1g"
logstash: logstash:
image: logstash:5 build: logstash/
command: -f /etc/logstash/conf.d/ command: -f /etc/logstash/conf.d/
volumes: volumes:
- ./logstash/config:/etc/logstash/conf.d - ./logstash/config:/etc/logstash/conf.d

4
logstash/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM logstash:latest
# Add your logstash plugins setup here
# Example: RUN logstash-plugin install logstash-filter-json

View File

@ -4,7 +4,7 @@ input {
} }
} }
## Add your filters here ## Add your filters / logstash plugins configuration here
output { output {
elasticsearch { elasticsearch {