Comments (8)
@thaarbach I've added index template loading via:
- absolute path and classpath
- raw value in XML config - if one can cope with it's "noisiness", then why not? ;)
Thank you for this feature request! :)
from log4j2-elasticsearch.
Ok, I need to do some experiments here since we have a couple of options:
- File path - it makes sense to handle absolute paths, relative paths and classpath. I think it should be injectable via env property as well.
- Interface for user-provided template loader - fully qualified class name of the impl would be required in the config. That'd give maximum flexibility to the user. May be loaded via SPI as well, but that'd make it global for all appenders.
For a start I can implement absolute path and classpath handling just so you can make progress with your work, but do you think it makes sense to handle other cases?
from log4j2-elasticsearch.
Hi Rafal,
IMHO option 1 would be grate and enough. It's only necessary for Elasticsearch and does not make sense to make it globally accessible to other appenders. I don't know, if there is an other use case with could benifit from a template mechanism.
Btw. the index template below is testet on our ES cluster. This could be used as a default index template in the class path of your appenders.
Thx, for your fast anwser
from log4j2-elasticsearch.
Hi Rafal,
have an other Idea. Is it possible to implement sth. like that?
<Elasticsearch name="elasticsearch">
<JsonLayout compact="true" properties="true" />
<AsyncBatchDelivery indexName="log4j2" deliveryInterval="5000" batchSize="500">
<IndexTemplate>
{
"template": "log4j2*",
"settings": {
"index": {
"refresh_interval": "5s"
}
},
"mappings": {
...
...
}
</IndexTemplate>
<JestHttp serverUris="http://localhost:9200" />
</AsyncBatchDelivery>
</Elasticsearch>
<IndexTemplate>
could also offer the options to declare a classpath, filepath etc. E.g.
<IndexTemplate path="classpath:template.json">
What do you think?
from log4j2-elasticsearch.
I'm not sure whether Log4j config parser would handle the value passed like that, but <IndexTemplate path="classpath:template.json">
is exactly how I planned to add it :)
from log4j2-elasticsearch.
The idea was, to handle it in the same way as Scripts without evaluate it. Maybe it must be surrounded with <![CDATA[]]
. In this case the Config Parser should not complain about it and the value is interpreted as a string.
from log4j2-elasticsearch.
Ok, that might work. But it looks a bit too messy for my taste. File-based approach seems like a way to go here.
from log4j2-elasticsearch.
Yes, it looks really a little bit messy, but you doesn't have spread the configurations arround. Classpath or filepath would be good enought. I just thought about it :)
from log4j2-elasticsearch.
Related Issues (20)
- Supporting ecs-logging-java HOT 8
- Package naming conventions HOT 11
- How to pass the value from ThreadContext to ValueProperty? HOT 3
- Can not log to elastic using log4j2 <PatternLayout> HOT 11
- Support elasticsearch data_streams HOT 6
- Failed to Load StackTraceElementMixIn HOT 22
- InvalidTypeNameException on invalid mappingType in ES 5 HOT 8
- Adding custom properties, that change during processing HOT 4
- Log4j2 Zero-Day vulnerability (CVE-2021-44228) HOT 2
- Support OpenSearch 2.x and Elasticsearch 8.x HOT 9
- Unable to determine if index already exists HOT 1
- Support for ECSLayout for elasticsearch-ahc and / or elaticsearch-jest in combination with data streams HOT 10
- Is it possible to deseriailze JSON within the message into properties? HOT 2
- Run elastic search appender in specific environment HOT 2
- Logging-Cleaner ERROR Could not create plugin HOT 3
- How do I add mdc attributes? HOT 1
- Could not initialize ChronicleMapRetryFailoverPolicy HOT 2
- ServiceDiscovery ERROR HCServiceDiscovery: Unable to refresh addresses: Cannot invoke "org.appenders.log4j2.elasticsearch.hc.discovery.NodeInfo$PublishAddress.getPublishAddress()" HOT 1
- Using log4j2-elasticsearch-hc -> Does AsyncLogger still not support adding dynamic keyValue pairs in Jackson JSONLayout HOT 5
- IS JacksonModule is implemented in latest version? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from log4j2-elasticsearch.