Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/elk #4

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cluster.name: "docker-cluster"
network.host: 0.0.0.0

# minimum_master_nodes need to be explicitly set when bound on a public IP
# set to 1 to allow single node clusters
# Details: https://github.com/elastic/elasticsearch/pull/17288
discovery.zen.minimum_master_nodes: 1
99 changes: 99 additions & 0 deletions plugins/environment/elk/config/elasticsearch/jvm.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
## JVM configuration

################################################################
## IMPORTANT: JVM heap size
################################################################
##
## You should always set the min and max JVM heap
## size to the same value. For example, to set
## the heap to 4 GB, set:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms500m
-Xmx500m

################################################################
## Expert settings
################################################################
##
## All settings below this section are considered
## expert settings. Don't tamper with them unless
## you understand what you are doing
##
################################################################

## GC configuration
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly

## optimizations

# pre-touch memory pages used by the JVM during initialization
-XX:+AlwaysPreTouch

## basic

# explicitly set the stack size
-Xss1m

# set to headless, just in case
-Djava.awt.headless=true

# ensure UTF-8 encoding by default (e.g. filenames)
-Dfile.encoding=UTF-8

# use our provided JNA always versus the system one
-Djna.nosys=true

# turn off a JDK optimization that throws away stack traces for common
# exceptions because stack traces are important for debugging
-XX:-OmitStackTraceInFastThrow

# flags to configure Netty
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0

# log4j 2
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true

-Djava.io.tmpdir=${ES_TMPDIR}

## heap dumps

# generate a heap dump when an allocation from the Java heap fails
# heap dumps are created in the working directory of the JVM
-XX:+HeapDumpOnOutOfMemoryError

# specify an alternative path for heap dumps
# ensure the directory exists and has sufficient space
#-XX:HeapDumpPath=/heap/dump/path

## JDK 8 GC logging

8:-XX:+PrintGCDetails
8:-XX:+PrintGCDateStamps
8:-XX:+PrintTenuringDistribution
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:logs/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m

# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
# due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise
# time/date parsing will break in an incompatible way for some date patterns and locals
9-:-Djava.locale.providers=COMPAT
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
status = error

appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n

rootLogger.level = info
rootLogger.appenderRef.console.ref = console
3 changes: 3 additions & 0 deletions plugins/environment/elk/docker-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4
environment:
- SERVICE_9200_NAME=elasticsearch
- discovery.type=single-node
ports:
- target: 9200
published: 9200
Expand All @@ -31,6 +32,8 @@ services:
protocol: tcp
mode: host
volumes:
- /var/lidop/elk/elasticsearch/:/usr/share/elasticsearch/config
- /usr/share/elasticsearch/config/ingest-geoip
- /var/lidop/elk/elasticsearch:/usr/share/elasticsearch/data
deploy:
restart_policy:
Expand Down
14 changes: 0 additions & 14 deletions plugins/environment/elk/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
folder: "/var/lidop/elk"

tasks:
- name: fix max memory
command: sysctl -w vm.max_map_count=262144

- name: delete directory
file:
path: "{{ folder }}"
Expand All @@ -22,17 +19,6 @@
dest: "{{ folder }}"
mode: 0644
when: state == "present"

- name: Create folders
file:
state: "directory"
path: "{{ folder }}{{ item }}"
owner: "{{ root_user }}"
group: "{{ root_user }}"
mode: '0777'
with_items:
- /elasticsearch
when: state == "present"

- name: set docker-compose
template:
Expand Down