[
https://issues.apache.org/jira/browse/FLUME-2576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Frédéric Rolland updated FLUME-2576:
------------------------------------
Description:
I use flume with Elasticsearch sink to insert events in Elasticsearch, and i
would like to use this pattern for index name : prefix-YYYY.MM.DD
I tried to customize the index name in my config file, like this :
agent_es.sinks.es_dest.indexNameBuilder.dateFormat = yyyy.MM.dd
But it does not change index name used.
As I tryed to debug flume code, I found this in class
org.apache.flume.sink.elasticsearch.ElasticSearchSink, at line 316:
{noformat}
Context indexnameBuilderContext = new Context();
serializerContext.putAll(
context.getSubProperties(INDEX_NAME_BUILDER_PREFIX));
{noformat}
It seems that wrong context is used, and following code would work better :
{noformat}
Context indexnameBuilderContext = new Context();
indexnameBuilderContext.putAll(
context.getSubProperties(INDEX_NAME_BUILDER_PREFIX));
{noformat}
was:
I use flume with Elasticsearch sink to insert events in Elasticsearch, and i
would like to use this pattern for index name : prefix-YYYY.MM.DD
I tried to customize the index name in my config file, like this :
agent_es.sinks.es_dest.indexNameBuilder.dateFormat = yyyy.MM.dd
But it does not change index name used.
As I tryed to debug flume code, I found this in class
org.apache.flume.sink.elasticsearch.ElasticSearchSink, at line 316:
Context indexnameBuilderContext = new Context();
serializerContext.putAll(
context.getSubProperties(INDEX_NAME_BUILDER_PREFIX));
It seems that wrong context is used, and following code would work better :
Context indexnameBuilderContext = new Context();
indexnameBuilderContext.putAll(
context.getSubProperties(INDEX_NAME_BUILDER_PREFIX));
> Elasticsearch sink: customizing dateFormat for IndexNameBuilder does not work
> -----------------------------------------------------------------------------
>
> Key: FLUME-2576
> URL: https://issues.apache.org/jira/browse/FLUME-2576
> Project: Flume
> Issue Type: Bug
> Components: Sinks+Sources
> Affects Versions: v1.5.2
> Environment: all
> Reporter: Frédéric Rolland
> Priority: Minor
> Fix For: notrack
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> I use flume with Elasticsearch sink to insert events in Elasticsearch, and i
> would like to use this pattern for index name : prefix-YYYY.MM.DD
> I tried to customize the index name in my config file, like this :
> agent_es.sinks.es_dest.indexNameBuilder.dateFormat = yyyy.MM.dd
> But it does not change index name used.
> As I tryed to debug flume code, I found this in class
> org.apache.flume.sink.elasticsearch.ElasticSearchSink, at line 316:
> {noformat}
> Context indexnameBuilderContext = new Context();
> serializerContext.putAll(
> context.getSubProperties(INDEX_NAME_BUILDER_PREFIX));
> {noformat}
> It seems that wrong context is used, and following code would work better :
> {noformat}
> Context indexnameBuilderContext = new Context();
> indexnameBuilderContext.putAll(
> context.getSubProperties(INDEX_NAME_BUILDER_PREFIX));
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)