Skip to content

Commit a9fab13

Browse files
author
P. Barrett Little
committed
Merge pull request pblittle#25 from pblittle/feature/readme-tweaks
Updated README to include more usage examples.
2 parents 5c18a32 + b4b7434 commit a9fab13

File tree

1 file changed

+56
-24
lines changed

1 file changed

+56
-24
lines changed

README.md

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,33 @@
22

33
This is a highly configurable logstash (1.4.2) image running elasticsearch (1.1.1) and Kibana 3 (3.0.1).
44

5-
## Optional first step, build image from source
5+
## Optional, build and run the image from source
66

7-
If you prefer to build from source rather than use the [pblittle/docker-logstash][1] trusted build published to the public Docker Registry, execute the following from the project root:
7+
If you prefer to build from source rather than use the [pblittle/docker-logstash][1] trusted build published to the public Docker Registry, execute the following:
88

9+
$ git clone https://github.com/pblittle/docker-logstash.git
10+
$ cd docker-logstash
911
$ make build
12+
$ make <options> run
13+
14+
See below for a complate example using `Vagrant`.
1015

1116
## Running Logstash
1217

13-
### First, choose an Elasticsearch configuration
18+
### First, prepare your Logstash configuration file
19+
20+
The logstash configuration file used in this container is downloaded from the internet using `wget`. The configuration file location is determined by the value of the `LOGSTASH_CONFIG_FILE` environment variable, which is set using the `-e` flag when executing `docker run`.
21+
22+
By default, unless `LOGSTASH_CONFIG_FILE` is overridden, an [example configuration file][2] for an embedded Elasticsearch will be downloaded, moved to `/opt/logstash.conf`, and used by logstash in your container.
23+
24+
I have created three reference config files that can be used for testing:
25+
26+
* [Embedded Elasticsearch server](https://gist.githubusercontent.com/pblittle/8778567/raw/logstash.conf) (default)
27+
* [Linked Elasticsearch container](https://gist.githubusercontent.com/pblittle/0b937485fa4a322ea9eb/raw/logstash_linked.conf)
28+
29+
You will find example usage of `-e LOGSTASH_CONFIG_URL=<your_logstash_config_url>` below.
30+
31+
### Second, choose an Elasticsearch install type
1432

1533
To run this logstash image, you have to first choose one of three Elasticsearch configurations.
1634

@@ -22,24 +40,35 @@ To run this logstash image, you have to first choose one of three Elasticsearch
2240

2341
To fetch and start a container running logstash and the embedded Elasticsearch server, simply execute:
2442

25-
$ docker run -d -p 9292:9292 -p 9200:9200 pblittle/docker-logstash
43+
$ docker run -d \
44+
-p 9292:9292 \
45+
-p 9200:9200 \
46+
pblittle/docker-logstash
2647

27-
Or, if you are working from the project source directory:
48+
If you want to use your own config file rather than the default, don't forget the `LOGSTASH_CONFIG_URL` environment variable as noted above:
2849

29-
$ make run
50+
$ docker run -d \
51+
-e LOGSTASH_CONFIG_URL=<your_logstash_config_url> \
52+
-p 9292:9292 \
53+
-p 9200:9200 \
54+
pblittle/docker-logstash
3055

31-
### Use a linked container running Elasticsearch
56+
Verify the logstash installation by visiting:
3257

33-
If you want to link to another container running elasticsearch rather than the embedded server, set the `ES_CONTAINER` environment variable to your existing elasticsearch container name.
58+
http://<your_container_ip>:9292/index.html#/dashboard/file/logstash.json
3459

35-
$ docker run -d --link <your_es_container_name>:es -p 9292:9292 -p 9200:9200 pblittle/docker-logstash
60+
### Use a linked container running Elasticsearch
3661

37-
Or, if you are working from the project source directory:
62+
If you want to link to another container running elasticsearch rather than use the embedded server:
3863

39-
$ export ES_CONTAINER=<your_es_container_name>
40-
$ make run
64+
$ docker run -d \
65+
-e LOGSTASH_CONFIG_URL=<your_logstash_config_url> \
66+
--link <your_es_container_name>:es
67+
-p 9292:9292
68+
-p 9200:9200
69+
pblittle/docker-logstash
4170

42-
In addition to the link, if you want your elasticsearch node's `bind_host` and `port` automatically detected, you will need to set the `ES_HOST` and `ES_PORT` placeholders in your `elasticsearch` definition in your logstash config file. For example:
71+
To have you the linked elasticsearch container's `bind_host` and `port` automatically detected, you will need to create an `ES_HOST` and `ES_PORT` placeholder in the `elasticsearch` definition in your logstash config file. For example:
4372

4473
output {
4574
elasticsearch {
@@ -48,22 +77,25 @@ In addition to the link, if you want your elasticsearch node's `bind_host` and `
4877
}
4978
}
5079

51-
### Use an external Elasticsearch server
80+
I have created an [example linked config file](https://gist.githubusercontent.com/pblittle/0b937485fa4a322ea9eb/raw/logstash_linked.conf) which includes the `ES_HOST` and `ES_PORT` placeholders described above.
81+
82+
Verify the logstash installation by visiting:
5283

53-
If you are using an external elasticsearch server rather than an embedded or linked server, simply set the `ES_HOST` and `ES_PORT` environment variables.
84+
http://<your_container_ip>:9292/index.html#/dashboard/file/logstash.json
5485

55-
$ export ES_HOST=<your_es_server_host>
56-
$ export ES_PORT=<your_es_server_port>
57-
$ make run
86+
### Use an external Elasticsearch server
5887

59-
## Logstash configuration
88+
If you are using an external elasticsearch server rather than the embedded server or a linked container, simply provide a configuration file with the Elasticsearch endpoints already configured:
6089

61-
Without any environment changes, an [example configuration file][2] will be created for you. You can override the example config by setting the `LOGSTASH_CONFIG_URL` environment variable to a file accessible via `wget`.
90+
$ docker run -d \
91+
-e LOGSTASH_CONFIG_URL=<your_logstash_config_url> \
92+
-p 9292:9292
93+
-p 9200:9200
94+
pblittle/docker-logstash
6295

63-
$ export LOGSTASH_CONFIG_URL=https://gist.github.com/pblittle/8778567/raw/logstash.conf
64-
$ make run
96+
Verify the logstash installation by visiting:
6597

66-
This config file set by `LOGSTASH_CONFIG_URL` will be downloaded, moved to `/opt/logstash.conf`, and used in your container.
98+
http://<your_container_ip>:9292/index.html#/dashboard/file/logstash.json
6799

68100
## Test locally using Vagrant
69101

@@ -81,7 +113,7 @@ Start and provision a virtual machine using the provided Vagrantfile:
81113
From there, build and run a container using the newly created virtual machine:
82114

83115
$ make build
84-
$ make run
116+
$ make <options> run
85117

86118
You can now verify the logstash installation by visiting the [prebuilt logstash dashboard][3] running in the newly created container.
87119

0 commit comments

Comments
 (0)