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

dynamic indexname #15

Closed
MonDeveloper opened this issue Feb 10, 2016 · 4 comments
Closed

dynamic indexname #15

MonDeveloper opened this issue Feb 10, 2016 · 4 comments

Comments

@MonDeveloper
Copy link

I usually configure the IndexName with a fixed part (the ImndexName prefix) + the rolling date part.
It worked smoothly.
Now I need something more complex, I need to change the IndexName prefix from "the fixed part" to "a dynamic part" based on a message field like %logger for instance. I tried using both %logger and %{logger} but anytime it has been literally copied as part of the final IndexName and not evaluated.

@urielha
Copy link
Owner

urielha commented Feb 18, 2016

Have you tried %{logger} ? this feature should work.
"logger" is a key name in your index data?

@MonDeveloper
Copy link
Author

I tried and it ends creating an index named literally
"my-prefix-%{logger}-2016-02-15" :-)

Il giorno gio 18 feb 2016 alle ore 19:13 Uriel Hai notifications@github.com
ha scritto:

Have you tried %{logger} ? this feature should work.
"logger" is a key name in your index data?


Reply to this email directly or view it on GitHub
urielha/log4stash#15 (comment).

@urielha
Copy link
Owner

urielha commented Apr 6, 2016

I'm sorry @MonDeveloper I couldn't reproduce this,

My configuration is:

<appender name="ElasticSearchAppender" type="log4net.ElasticSearch.ElasticSearchAppender, log4stash">
    <Server>localhost</Server>
    <Port>9200</Port>
    <IndexName>index_%{logger}</IndexName>
    <IndexType>LogEvent</IndexType>
    <Bulksize>1</Bulksize>
    <BulkIdleTimeout>-1</BulkIdleTimeout>
    <IndexAsync>False</IndexAsync>
    <FixedFields>Partial</FixedFields>  
    <ElasticFilters>
      <Add>
        <Key>logger</Key>
        <Value>name</Value>
      </Add>
    </ElasticFilters>
  </appender>

And it successfully created index name index_name

@urielha
Copy link
Owner

urielha commented Apr 12, 2016

This issue was moved to urielha/log4stash#5

@urielha urielha closed this as completed Apr 12, 2016
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