Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit f61bd53

Browse files
committed
add integration tests for custom config files
1 parent 04438f9 commit f61bd53

File tree

5 files changed

+137
-1
lines changed

5 files changed

+137
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Elasticsearch CUSTOM FILE
2+
3+
ES_HOME=/usr/share/elasticsearch
4+
ES_PATH_CONF=/etc/elasticsearch
5+
PID_DIR=/var/run/elasticsearch
6+
ES_JAVA_OPTS=
7+
ES_STARTUP_SLEEP_TIME=5
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## JVM configuration CUSTOM FILE
2+
3+
-Xms2g
4+
-Xmx2g
5+
-XX:+UseConcMarkSweepGC
6+
-XX:CMSInitiatingOccupancyFraction=75
7+
-XX:+UseCMSInitiatingOccupancyOnly
8+
-Des.networkaddress.cache.ttl=60
9+
-Des.networkaddress.cache.negative.ttl=10
10+
-XX:+AlwaysPreTouch
11+
-Xss1m
12+
-Djava.awt.headless=true
13+
-Dfile.encoding=UTF-8
14+
-Djna.nosys=true
15+
-XX:-OmitStackTraceInFastThrow
16+
-Dio.netty.noUnsafe=true
17+
-Dio.netty.noKeySetOptimization=true
18+
-Dio.netty.recycler.maxCapacityPerThread=0
19+
-Dlog4j.shutdownHookEnabled=false
20+
-Dlog4j2.disable.jmx=true
21+
-Djava.io.tmpdir=${ES_TMPDIR}
22+
-XX:+HeapDumpOnOutOfMemoryError
23+
-XX:HeapDumpPath=${heap.dump.path}
24+
-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log
25+
8:-XX:+PrintGCDetails
26+
8:-XX:+PrintGCDateStamps
27+
8:-XX:+PrintTenuringDistribution
28+
8:-XX:+PrintGCApplicationStoppedTime
29+
8:-Xloggc:/var/log/elasticsearch/gc.log
30+
8:-XX:+UseGCLogFileRotation
31+
8:-XX:NumberOfGCLogFiles=32
32+
8:-XX:GCLogFileSize=64m
33+
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m
34+
9-:-Djava.locale.providers=COMPAT
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{% raw %}
2+
# Log4j CUSTOM FILE
3+
4+
status = error
5+
logger.action.name = org.elasticsearch.action
6+
logger.action.level = debug
7+
appender.rolling.type = Console
8+
appender.rolling.name = rolling
9+
appender.rolling.layout.type = ESJsonLayout
10+
appender.rolling.layout.type_name = server
11+
rootLogger.level = info
12+
rootLogger.appenderRef.rolling.ref = rolling
13+
appender.deprecation_rolling.type = Console
14+
appender.deprecation_rolling.name = deprecation_rolling
15+
appender.deprecation_rolling.layout.type = ESJsonLayout
16+
appender.deprecation_rolling.layout.type_name = deprecation
17+
appender.deprecation_rolling.layout.esmessagefields=x-opaque-id
18+
logger.deprecation.name = org.elasticsearch.deprecation
19+
logger.deprecation.level = warn
20+
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
21+
logger.deprecation.additivity = false
22+
appender.index_search_slowlog_rolling.type = Console
23+
appender.index_search_slowlog_rolling.name = index_search_slowlog_rolling
24+
appender.index_search_slowlog_rolling.layout.type = ESJsonLayout
25+
appender.index_search_slowlog_rolling.layout.type_name = index_search_slowlog
26+
appender.index_search_slowlog_rolling.layout.esmessagefields=message,took,took_millis,total_hits,stats,search_type,total_shards,source,id
27+
logger.index_search_slowlog_rolling.name = index.search.slowlog
28+
logger.index_search_slowlog_rolling.level = trace
29+
logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling.ref = index_search_slowlog_rolling
30+
logger.index_search_slowlog_rolling.additivity = false
31+
appender.index_indexing_slowlog_rolling.type = Console
32+
appender.index_indexing_slowlog_rolling.name = index_indexing_slowlog_rolling
33+
appender.index_indexing_slowlog_rolling.layout.type = ESJsonLayout
34+
appender.index_indexing_slowlog_rolling.layout.type_name = index_indexing_slowlog
35+
appender.index_indexing_slowlog_rolling.layout.esmessagefields=message,took,took_millis,doc_type,id,routing,source
36+
logger.index_indexing_slowlog.name = index.indexing.slowlog.index
37+
logger.index_indexing_slowlog.level = trace
38+
logger.index_indexing_slowlog.appenderRef.index_indexing_slowlog_rolling.ref = index_indexing_slowlog_rolling
39+
logger.index_indexing_slowlog.additivity = false
40+
appender.audit_rolling.type = Console
41+
appender.audit_rolling.name = audit_rolling
42+
appender.audit_rolling.layout.type = PatternLayout
43+
appender.audit_rolling.layout.pattern = {\
44+
"type": "audit", \
45+
"timestamp":"%d{yyyy-MM-dd'T'HH:mm:ss,SSSZ}"\
46+
%varsNotEmpty{, "node.name":"%enc{%map{node.name}}{JSON}"}\
47+
%varsNotEmpty{, "node.id":"%enc{%map{node.id}}{JSON}"}\
48+
%varsNotEmpty{, "host.name":"%enc{%map{host.name}}{JSON}"}\
49+
%varsNotEmpty{, "host.ip":"%enc{%map{host.ip}}{JSON}"}\
50+
%varsNotEmpty{, "event.type":"%enc{%map{event.type}}{JSON}"}\
51+
%varsNotEmpty{, "event.action":"%enc{%map{event.action}}{JSON}"}\
52+
%varsNotEmpty{, "user.name":"%enc{%map{user.name}}{JSON}"}\
53+
%varsNotEmpty{, "user.run_by.name":"%enc{%map{user.run_by.name}}{JSON}"}\
54+
%varsNotEmpty{, "user.run_as.name":"%enc{%map{user.run_as.name}}{JSON}"}\
55+
%varsNotEmpty{, "user.realm":"%enc{%map{user.realm}}{JSON}"}\
56+
%varsNotEmpty{, "user.run_by.realm":"%enc{%map{user.run_by.realm}}{JSON}"}\
57+
%varsNotEmpty{, "user.run_as.realm":"%enc{%map{user.run_as.realm}}{JSON}"}\
58+
%varsNotEmpty{, "user.roles":%map{user.roles}}\
59+
%varsNotEmpty{, "origin.type":"%enc{%map{origin.type}}{JSON}"}\
60+
%varsNotEmpty{, "origin.address":"%enc{%map{origin.address}}{JSON}"}\
61+
%varsNotEmpty{, "realm":"%enc{%map{realm}}{JSON}"}\
62+
%varsNotEmpty{, "url.path":"%enc{%map{url.path}}{JSON}"}\
63+
%varsNotEmpty{, "url.query":"%enc{%map{url.query}}{JSON}"}\
64+
%varsNotEmpty{, "request.method":"%enc{%map{request.method}}{JSON}"}\
65+
%varsNotEmpty{, "request.body":"%enc{%map{request.body}}{JSON}"}\
66+
%varsNotEmpty{, "request.id":"%enc{%map{request.id}}{JSON}"}\
67+
%varsNotEmpty{, "action":"%enc{%map{action}}{JSON}"}\
68+
%varsNotEmpty{, "request.name":"%enc{%map{request.name}}{JSON}"}\
69+
%varsNotEmpty{, "indices":%map{indices}}\
70+
%varsNotEmpty{, "opaque_id":"%enc{%map{opaque_id}}{JSON}"}\
71+
%varsNotEmpty{, "x_forwarded_for":"%enc{%map{x_forwarded_for}}{JSON}"}\
72+
%varsNotEmpty{, "transport.profile":"%enc{%map{transport.profile}}{JSON}"}\
73+
%varsNotEmpty{, "rule":"%enc{%map{rule}}{JSON}"}\
74+
%varsNotEmpty{, "event.category":"%enc{%map{event.category}}{JSON}"}\
75+
}%n
76+
logger.xpack_security_audit_logfile.name = org.elasticsearch.xpack.security.audit.logfile.LoggingAuditTrail
77+
logger.xpack_security_audit_logfile.level = info
78+
logger.xpack_security_audit_logfile.appenderRef.audit_rolling.ref = audit_rolling
79+
logger.xpack_security_audit_logfile.additivity = false
80+
logger.xmlsig.name = org.apache.xml.security.signature.XMLSignature
81+
logger.xmlsig.level = error
82+
logger.samlxml_decrypt.name = org.opensaml.xmlsec.encryption.support.Decrypter
83+
logger.samlxml_decrypt.level = fatal
84+
logger.saml2_decrypt.name = org.opensaml.saml.saml2.encryption.Decrypter
85+
logger.saml2_decrypt.level = fatal
86+
{% endraw %}

test/integration/helpers/serverspec/oss_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44
describe file("/etc/elasticsearch/log4j2.properties") do
55
it { should be_file }
66
it { should be_owned_by 'root' }
7-
it { should_not contain 'CUSTOM LOG4J FILE' }
7+
it { should contain 'Log4j CUSTOM FILE' }
88
end
99
describe file("/etc/elasticsearch/jvm.options") do
1010
it { should be_file }
1111
it { should be_owned_by 'root' }
12+
it { should contain 'JVM configuration CUSTOM FILE' }
13+
end
14+
describe file(family['defaults_path']) do
15+
it { should be_file }
16+
it { should be_owned_by 'root' }
17+
it { should contain 'Elasticsearch CUSTOM FILE' }
1218
end
1319
end

test/integration/oss.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
es_heap_size: "1g"
1111
es_plugins:
1212
- plugin: ingest-attachment
13+
es_config_default: "test/integration/files/custom_config/elasticsearch"
14+
es_config_log4j2: "test/integration/files/custom_config/log4j2.properties"
15+
es_config_jvm: "test/integration/files/custom_config/jvm.options"
1316

1417
#Do not add tests here. This test is run twice and confirms idempotency.

0 commit comments

Comments
 (0)