Skip to content

Commit f1adb5c

Browse files
committed
Fixes #196: ELK example needs updating for modern usage.
1 parent ff6e67c commit f1adb5c

File tree

14 files changed

+25
-94
lines changed

14 files changed

+25
-94
lines changed

elk/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
This project builds a two-server ELK stack using Elasticsearch, Logstash, Kibana, and Filebeat to ship, store, and expose logs.
44

5-
The first server (`logs`) has the entire ELK stack running, and pushes local auth.log entries into Elasticsearch via Filebeat and Logstash. The second server (`webs`) runs an Nginx webserver and pushes the webserver access.log file and the server's auth.log entries into Elasticsearch via the `logs` server's Logstash instance.
5+
The first server (`logs`) has the entire ELK stack running, and pushes local auth.log entries into Elasticsearch via Filebeat and Logstash. The second server (`web`) runs an Nginx webserver and pushes the webserver access.log file and the server's auth.log entries into Elasticsearch via the `logs` server's Logstash instance.
66

7-
Logs are transmitted securely using a self-signed certificate (see the `elk-vagrant-example` certificate).
7+
Logs are transmitted securely using a self-signed certificate (see the `elk-example` certificate).
88

99
## Building the VMs
1010

@@ -14,18 +14,18 @@ Logs are transmitted securely using a self-signed certificate (see the `elk-vagr
1414
4. Run `ansible-galaxy install -r requirements.yml` in this directory to get the required Ansible roles.
1515
5. Run `vagrant up` to build the VMs.
1616

17-
Once the VMs are up and running (after `vagrant up` is complete and you're back at the command prompt), you can log into either one via SSH if you'd like by typing in `vagrant ssh [name]` (either `logs` for the ELK server, or `webs` for the Nginx web server). Otherwise, the next steps are below.
17+
Once the VMs are up and running (after `vagrant up` is complete and you're back at the command prompt), you can log into either one via SSH if you'd like by typing in `vagrant ssh [name]` (either `logs` for the ELK server, or `web` for the Nginx web server). Otherwise, the next steps are below.
1818

1919
### Setting up your hosts file
2020

2121
You need to modify your host machine's hosts file (Mac/Linux: `/etc/hosts`; Windows: `%systemroot%\system32\drivers\etc\hosts`), adding the lines below:
2222

2323
192.168.9.90 logs.test
24-
192.168.9.91 webs.test
24+
192.168.9.91 web.test
2525

26-
(Where `logs.test`/`webs.test` is the hostname you have configured in the `Vagrantfile`).
26+
(Where `logs.test`/`web.test` is the hostname you have configured in the `Vagrantfile`).
2727

28-
After that is configured, you could visit http://logs.test/ in a browser, and you'll see the Kibana dashboard, and you can visit http://webs.test/, and you'll see Nginx's default index page.
28+
After that is configured, you could visit http://logs.test/ in a browser, and you'll see the Kibana dashboard, and you can visit http://web.test/, and you'll see Nginx's default index page.
2929

3030
If you'd like additional assistance editing your hosts file, please read [How do I modify my hosts file?](http://www.rackspace.com/knowledge_center/article/how-do-i-modify-my-hosts-file) from Rackspace.
3131

elk/Vagrantfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
2020
logs.vm.network :private_network, ip: "192.168.9.90"
2121

2222
logs.vm.provision :ansible do |ansible|
23-
ansible.playbook = "provisioning/elk/playbook.yml"
23+
ansible.compatibility_mode = "2.0"
24+
ansible.playbook = "provisioning/elk/main.yml"
2425
ansible.inventory_path = "provisioning/elk/inventory"
2526
ansible.become = true
2627
end
2728
end
2829

2930
# Web server.
30-
config.vm.define "webs" do |webs|
31-
webs.vm.hostname = "webs.test"
32-
webs.vm.network :private_network, ip: "192.168.9.91"
31+
config.vm.define "web" do |web|
32+
web.vm.hostname = "web.test"
33+
web.vm.network :private_network, ip: "192.168.9.91"
3334

34-
webs.vm.provision :ansible do |ansible|
35+
web.vm.provision :ansible do |ansible|
3536
ansible.compatibility_mode = "2.0"
36-
ansible.playbook = "provisioning/web/playbook.yml"
37+
ansible.playbook = "provisioning/web/main.yml"
3738
ansible.inventory_path = "provisioning/web/inventory"
3839
ansible.become = true
3940
end

elk/provisioning/elk/playbook.yml renamed to elk/provisioning/elk/main.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
---
2-
# Ansible playbook for an ELK (Elasticsearch, Logstash, Kibana) logging server.
3-
#
4-
# @author Jeff Geerling (2014).
5-
62
- hosts: logs
73
gather_facts: yes
84

elk/provisioning/elk/vars/main.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
java_packages:
33
- openjdk-8-jdk
44

5-
kibana_server_name: logs.test
6-
kibana_username: kibana
7-
kibana_password: password
8-
95
nginx_user: www-data
10-
nginx_worker_connections: 1024
116
nginx_remove_default_vhost: true
127
nginx_vhosts:
138
# Kibana proxy.
@@ -22,15 +17,17 @@ nginx_vhosts:
2217
proxy_read_timeout 90s;
2318
}
2419
25-
logstash_ssl_key_file: elk-vagrant-example.p8
26-
logstash_ssl_certificate_file: elk-vagrant-example.crt
20+
elasticsearch_curator_pip_package: python3-pip
21+
22+
logstash_ssl_key_file: elk-example.p8
23+
logstash_ssl_certificate_file: elk-example.crt
2724

2825
filebeat_output_logstash_enabled: true
2926
filebeat_output_logstash_hosts:
3027
- "logs.test:5044"
3128

32-
filebeat_ssl_key_file: elk-vagrant-example.p8
33-
filebeat_ssl_certificate_file: elk-vagrant-example.crt
29+
filebeat_ssl_key_file: elk-example.p8
30+
filebeat_ssl_certificate_file: elk-example.crt
3431
filebeat_ssl_insecure: "true"
3532

3633
filebeat_inputs:

elk/provisioning/web/elk-vagrant-example.key

Lines changed: 0 additions & 28 deletions
This file was deleted.

elk/provisioning/web/elk-vagrant-example.p8

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)