Skip to content

Enable docker profile in CI for log4j-layout-template-json-test #2953

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

Merged
merged 11 commits into from
Sep 17, 2024
112 changes: 59 additions & 53 deletions log4j-layout-template-json-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,6 @@
<build>
<plugins>

<!-- Disable ITs, which are Docker-dependent, by default. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -154,11 +137,6 @@
indeed handles everything in UTF-8 without implicitly
relying on the system defaults. -->
<argLine>-Dfile.encoding=US-ASCII</argLine>
<systemPropertyVariables>
<!-- Enable JUnit 5 parallel execution. -->
<junit.jupiter.execution.parallel.enabled>true</junit.jupiter.execution.parallel.enabled>
<junit.jupiter.execution.parallel.mode.default>concurrent</junit.jupiter.execution.parallel.mode.default>
</systemPropertyVariables>
</configuration>
</plugin>

Expand All @@ -170,12 +148,20 @@

<id>docker</id>

<!--
~ Only the `ubuntu` CI runners have access to Docker
-->
<activation>
<activeByDefault>false</activeByDefault>
<os>
<family>linux</family>
</os>
<property>
<name>env.CI</name>
<value>true</value>
</property>
</activation>

<properties>
<elastic.version>8.10.2</elastic.version>
<!-- `docker run elasticsearch:<TAG>` exists with code 137 due to insufficient memory.
We limit the used JVM memory to avoid this OOM failure. -->
<elastic.java-opts>-Xms750m -Xmx750m</elastic.java-opts>
Expand All @@ -202,7 +188,8 @@
<ES_JAVA_OPTS>${elastic.java-opts}</ES_JAVA_OPTS>
</env>
<ports>
<port>9200:9200</port>
<!-- Binds an ephemeral port to the `elasticsearch.port` Maven property. -->
<port>localhost:elasticsearch.port:9200</port>
</ports>
<network>
<mode>custom</mode>
Expand Down Expand Up @@ -235,8 +222,10 @@
<LS_JAVA_OPTS>${elastic.java-opts}</LS_JAVA_OPTS>
</env>
<ports>
<port>12222:12222</port>
<port>12345:12345</port>
<!-- Binds an ephemeral port to the `logstash.gelf.port` Maven property. -->
<port>localhost:logstash.gelf.port:12222</port>
<!-- Binds an ephemeral port to the `logstash.tcp.port` Maven property. -->
<port>localhost:logstash.tcp.port:12345</port>
</ports>
<log>
<prefix>[LS]</prefix>
Expand All @@ -248,54 +237,65 @@
<arg>--pipeline.batch.size</arg>
<arg>1</arg>
<arg>-e</arg>
<arg>input {
<arg><![CDATA[

input {

# Documentation: https://www.elastic.co/guide/en/logstash/current/plugins-inputs-gelf.html
gelf {
host =&gt; "logstash"
use_tcp =&gt; true
use_udp =&gt; false
port =&gt; 12222
type =&gt; "gelf"
host => "logstash"
use_tcp => true
use_udp => false
port => 12222
type => "gelf"
}

# Documentation: https://www.elastic.co/guide/en/logstash/current/plugins-inputs-tcp.html
tcp {
port =&gt; 12345
codec =&gt; json
type =&gt; "tcp"
port => 12345
codec => json
type => "tcp"
}

}

filter {
if [type] == "gelf" {
# These are GELF/Syslog logging levels as defined in RFC 3164.
# Map the integer level to its human readable format.
# Map the integer level to its human-readable format.
# Documentation: https://www.elastic.co/guide/en/logstash/current/plugins-filters-translate.html
translate {
field =&gt; "[level]"
destination =&gt; "[levelName]"
dictionary =&gt; {
"0" =&gt; "EMERG"
"1" =&gt; "ALERT"
"2" =&gt; "CRITICAL"
"3" =&gt; "ERROR"
"4" =&gt; "WARN"
"5" =&gt; "NOTICE"
"6" =&gt; "INFO"
"7" =&gt; "DEBUG"
source => "[level]"
target => "[levelName]"
dictionary => {
"0" => "EMERG"
"1" => "ALERT"
"2" => "CRITICAL"
"3" => "ERROR"
"4" => "WARN"
"5" => "NOTICE"
"6" => "INFO"
"7" => "DEBUG"
}
}
}
}

# Documentation: https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html
output {
# (Un)comment for debugging purposes
# stdout { codec =&gt; rubydebug }
stdout { codec => rubydebug }
elasticsearch {
hosts =&gt; ["http://elasticsearch:9200"]
index =&gt; "log4j"
hosts => ["http://elasticsearch:9200"]
index => "log4j"
}
}</arg>
}

]]></arg>
</exec>
</entrypoint>
<wait>
<log>Successfully started Logstash API endpoint</log>
<log>Pipelines running</log>
<time>60000</time>
</wait>
</run>
Expand Down Expand Up @@ -327,6 +327,12 @@
<includes>
<include>**/*IT.java</include>
</includes>
<systemPropertyVariables>
<log4j2.debug>true</log4j2.debug>
<log4j.elasticsearch.port>${elasticsearch.port}</log4j.elasticsearch.port>
<log4j.logstash.gelf.port>${logstash.gelf.port}</log4j.logstash.gelf.port>
<log4j.logstash.tcp.port>${logstash.tcp.port}</log4j.logstash.tcp.port>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
Expand Down
Loading