Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
add ELK stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Talbot committed Jun 4, 2018
1 parent 89b87ed commit 81a7763
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ What things you need to install the software and how to install them

### Installing

* Go to the project dir : `cd nozomiBot`
* Copy `.env.dist` to `.env` : `cp .env.dist .env`
* Configure `.env` : `vim .env`
* Set the rights to `var` (`1000` is the user `node` in the node container) : `setfacl -dR -m u:$(id -u):rwX -m u:1000:rwX var`
* Install the dependencies : `yarn install`
* Install the dependencies : `docker run -it --rm -u $(id -u):$(id -g) -v "$PWD":/app -w /app node:8-alpine yarn install`
* Launch Docker containers :
* development env : `docker-compose up -d`
* production env : `docker stack deploy -c docker-compose.yml <name>`
Expand Down
3 changes: 2 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
const fs = require('fs');

const logger = require('pino')({
extreme: false
extreme: false,
base: null,
}, fs.createWriteStream(`./var/log/${process.env.NODE_ENV}.log`, {'flags': 'a'}));

const DatabaseManager = require('./lib/Database/DatabaseManager');
Expand Down
22 changes: 21 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
stdin_open: true
tty: true
entrypoint: ["node", "app.js"]
restart: unless-stopped
# restart: unless-stopped
depends_on:
- mongo
- redis
Expand All @@ -48,3 +48,23 @@ services:
ports:
- 127.0.0.1:6379:6379
restart: unless-stopped
# elk:
# image: sebp/elk:624
# hostname: ${COMPOSE_PROJECT_NAME}-elk
# volumes:
# - ./logstash.conf:/etc/logstash/conf.d/02-beats-input.conf
# networks:
# - app
# ports:
# - 127.0.0.1:5601:5601 # Kibana web interface
# - 127.0.0.1:9200:9200 # ElasticSearch JSON interface
# - 127.0.0.1:5044:5044 # Logstash beats interface
# filebeat:
# image: docker.elastic.co/beats/filebeat:6.2.4
# volumes:
# - ./filebeat.yml:/usr/share/filebeat/filebeat.yml
# - ./:/app
# depends_on:
# - elk
# networks:
# - app
22 changes: 22 additions & 0 deletions filebeat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
output:
logstash:
enabled: true
hosts:
- elk:5044
timeout: 15

filebeat:
prospectors:
- type: log
enabled: true
paths:
- "/app/var/log/*.log"
tags: ["json"]
json:
keys_under_root: true
add_error_key: true
message_key: msg

setup:
kibana:
host: elk:5601
5 changes: 5 additions & 0 deletions logstash.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
input {
beats {
port => 5044
}
}

0 comments on commit 81a7763

Please sign in to comment.