Code Monkey home page Code Monkey logo

Comments (8)

rfoltyns avatar rfoltyns commented on June 19, 2024 2

@thaarbach I've added index template loading via:

  1. absolute path and classpath
  2. 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.

rfoltyns avatar rfoltyns commented on June 19, 2024 1

Ok, I need to do some experiments here since we have a couple of options:

  1. File path - it makes sense to handle absolute paths, relative paths and classpath. I think it should be injectable via env property as well.
  2. 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.

thaarbach avatar thaarbach commented on June 19, 2024

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.

thaarbach avatar thaarbach commented on June 19, 2024

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.

rfoltyns avatar rfoltyns commented on June 19, 2024

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.

thaarbach avatar thaarbach commented on June 19, 2024

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.

rfoltyns avatar rfoltyns commented on June 19, 2024

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.

thaarbach avatar thaarbach commented on June 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.