Unable to add LABELS with forward slash for Elastic Common Schema (ECS) formatting
See original GitHub issueEnvironment:
- Jib version: 3.2.1
- Build tool: Maven 3.6.3
- OS: macOS Monterey
Description of the issue: I would like to build an image with filebeat LABELS in order to push Elastic Common Schema (ECS) formatting logs to my Elastic instance. See documentation here. The problem is I am not able to set labels as there is a forward slash in the key:
co.elastic.logs/json.keys_under_root: true
co.elastic.logs/json.overwrite_keys: true
co.elastic.logs/json.add_error_key: true
co.elastic.logs/json.expand_keys: true
Is there any way to deal with that situation? Or Maybe is that possible to integrate the possibility to set labels another way as:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<from>
<image>gcr.io/distroless/java17-debian11</image>
</from>
<to>
<image>...</image>
</to>
<container>
<ports>
<port>8080</port>
</ports>
<labels>
"co.elastic.logs/json.keys_under_root"=true
"co.elastic.logs/json.overwrite_keys"=true
"co.elastic.logs/json.add_error_key"=true
"co.elastic.logs/json.expand_keys"=true
</labels>
</container>
</configuration>
</plugin>
Expected behavior:
Steps to reproduce:
jib-maven-plugin
Configuration:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<from>
<image>gcr.io/distroless/java17-debian11</image>
</from>
<to>
<image>...</image>
</to>
<container>
<ports>
<port>8080</port>
</ports>
<labels>
<co.elastic.logs/json.keys_under_root>true</co.elastic.logs/json.keys_under_root>
<co.elastic.logs/json.overwrite_keys>true</co.elastic.logs/json.overwrite_keys>
<co.elastic.logs/json.add_error_key>true</co.elastic.logs/json.add_error_key>
<co.elastic.logs/json.expand_keys>true</co.elastic.logs/json.expand_keys>
</labels>
</container>
</configuration>
</plugin>
Log output:
Additional Information:
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
ECS fields | Filebeat Reference [8.5] - Elastic
This section defines Elastic Common Schema (ECS) fields—a common set of fields to be used when storing event data in Elasticsearch.
Read more >AWS::Logs::LogGroup - AWS CloudFormation
Log group names consist of the following characters: a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period). Syntax. To...
Read more >Troubleshooting the GitLab agent for Kubernetes
This error occurs when the kas-address doesn't include a trailing slash. To fix this issue, make sure that the wss or ws URL...
Read more >class ECS. Client - Boto3 Docs 1.26.27 documentation
Amazon Elastic Container Service (Amazon ECS) is a highly scalable, fast, ... The name can't include hyphens (-), tilde (~), greater than (>),...
Read more >Logstash: Path to ECS for 8.0 - YouTube
The Elastic Common Schema is a community-driven effort to provide consistent semantic meaning to datasets so that data from disparate ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
One workaround is to set Maven properties. System properties (e.g.,
-Djib.container.labels=...
on the command-line) also work. The format is comma-separated key-value pairs:Looks like we can use
Properties
instead ofMap
for our configuration Mojo, which seems backward-compatible. But I think it would still not be possible to use special characters in key names due to the XML syntax constraint.Thank you so much for the workaround Chanseok! And thanks for verifying @HamedKaramoko! Hopefully this will be helpful for those who come across this issue in the future.