bruno-garcia / log4net.ElasticSearch

log4net appender to ElasticSearch
https://bruno-garcia.github.io/log4net.ElasticSearch/
Other
220 stars 92 forks source link

Custom routing #101

Closed ferreirix closed 6 years ago

ferreirix commented 6 years ago

Hi,

I'm trying to implement routing as described here but I haven't figured it out how to specify my route in the connection string.

<connectionString value="Server=192.168.xxx.xxx;Index=sync?routing=synx5;" />

Thank you in advance for any help :)

ferreirix commented 6 years ago

After digging the code a little bit, I believe that we would need to actually add a parameter to support this scenario, right?

In their examples there is: $ curl -XPOST 'http://localhost:9200/store/order?routing=user123' -d ' { "productName":"sample", "customerID":"user123" }

which represents: $ curl -XPOST 'http://localhost:9200/{INDEX}/{DOC_TYPE}?routing={ROUTE_PARAM}

Sorry for some mistake, I'm new to elasticsearch..

Thank you again.

ferreirix commented 6 years ago

PR -> #102

I'd also like to add the possibility to create index per month/year. Right now there is only the option for daily index right? What do you think?

Cheers

jptoto commented 6 years ago

@ferreirix Right on! I never thought to add routing but there's certainly no reason why not. Nice work.

I only recently have encountered users who use weekly or monthly indices so that's definitely something that we can implement Mind working on a PR for that?

ferreirix commented 6 years ago

Yes i can take a look. Do you have any idea for the xml configuration of this feature?

ferreirix commented 6 years ago

@jptoto What do you think of adding a pattern like Index=myIndex{yyyy-mm} . Or do you have another idea? Because this would be a little redundant with the Rolling parameter.