urielha / log4stash

Module to Log log4net Messages to ElasticSearch
MIT License
60 stars 44 forks source link

Using the template returns not data #66

Open inesEl opened 4 years ago

inesEl commented 4 years ago

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>`

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])

2) Add the values in ElasticFilters as key value pairs in the add tag 3) 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 commented 4 years ago

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.