Skip to content
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

Using the template returns not data #66

Open
inesEl opened this issue Jun 19, 2020 · 1 comment
Open

Using the template returns not data #66

inesEl opened this issue Jun 19, 2020 · 1 comment

Comments

@inesEl
Copy link

inesEl commented Jun 19, 2020

Hello,
I have decided to use a template to display the specific fields that I need. I have a configuration for Log4net file and I wanted to send the same fields to Elasticsearch. In the fileappender I have something like

<layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date{ISO8601} [%-5level] [%2thread] [%property{CorrelationId}] [%logger{1}] - %message%newline%exception"/> </layout>

I want all of these fields and I added a template that will only have these properties. The template is created as well as the index but no data is added.

I tried the following:

  1. Add
<IndexOperationParams>
		<Parameter>
			<Key>_id</Key>
			<Value>%{IdSource}</Value>
		</Parameter>
 this one gives nasty errors (log4net:ERROR XmlHierarchyConfigurator: Cannot find Property [Parameter] to set object on [log4stash.Configuration.IndexOperationParamsDictionary])
  1. Add the values in ElasticFilters as key value pairs in the add tag
  2. Add the pattern showed above

None worked I am a little bit lost as what to do in order to have the fields in my template shown and have my data in elasticsearch.

Thank you for your help @urielha .

@urielha
Copy link
Owner

urielha commented Jul 8, 2020

While sending the request to index, do you see any error on you elastic server?
I believe log4stash still trying to send all logger properties to the server and since you declared the template explicitly it may caused an issue.

Try use Remove filter to remove unused properties. It is a bit inconvenience but can work.


Regarding IndexOperationParams error

  1. Are you using the latest version?
  2. I know it is a weird question but can you try <OrSetParameter> instead of <Parameter>
  3. Pay attention that you used IdSource as Value and if you don't have property named that way it won't set it right.

urielha added a commit that referenced this issue Jun 27, 2021
* Fix function name of IndexOperationParams
   In order to accept <Parameter> it should be named AddParameter()

* Fixed Tests

* May be related to issu #66 

Co-authored-by: Eran Gil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants