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

ism index patterns based on indexAlias/index #5117 #5118

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kranthikirang
Copy link

Description

We will be able to update the index_patterns of the ISM policy based on the indexAlias created (more useful when its dynamic and/or with rollover feature) when user supplies ism_policy_file. This will not interfere when user wants to manage the policy with superset of wildcard (which should be a manual step). This commit will only ensure policy's index_patterns are updated when user supplies policy_json_file.

Example:
route:
- cluster-utils: '/route_name == "cluster"'
sink:

  • opensearch:
    hosts: [ "https://opensearch-node1:9200","https://opensearch-node2:9200" ]

    Change to your credentials

    username: "admin"
    password: "PGjGcHKfQW1U"
    insecure: true
    dlq_file: /usr/share/data-prepper/log/data-prepper/dlq.log

    Add a certificate file if you are accessing an OpenSearch cluster with a self-signed certificate

    #cert: /path/to/cert
    normalize_index: true
    index: cluster-utils_eastus2_${cluster_name}
    index_type: custom
    template_type: v1
    template_file: /usr/share/data-prepper/templates/template-file.json
    ism_policy_file: /usr/share/data-prepper/policies/ism-policy.json
    routes: [cluster-utils]

Where using data prepper we will create ism policy (if user supplies wildcard cluster-utils*) each time we receive a different cluster_name and will fail because opensearch will not allow having same patterns in multiple policies. Also keeping a single policy wouldn't make sense if we want to manage via AP. with this change data-prepper will create new policy with index pattern as cluster-utils_eastus2_${cluster_name}* which will in-align to index template index_patterns. Also, previous functionality will also work as index_patterns are specific to the indexAlias. However users will have to re-run the policies on the older indexes created.

Extremely useful with rollover through ISM policy.

Issues Resolved

Resolves #5117

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: kranthikirang <kranthi.guttikonda9@gmail.com>
@kranthikirang
Copy link
Author

kranthikirang commented Nov 7, 2024

Can anyone look into this PR please? @dlvenable

Copy link
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @kranthikirang for this contribution. I have a few questions and then some specific comments.

What was the ISM policy this created for your index?

Did you try with any variables that are not at the end?

Signed-off-by: kranthikirang <kranthi.guttikonda9@gmail.com>
Signed-off-by: kranthikirang <kranthi.guttikonda9@gmail.com>
Signed-off-by: kranthikirang <kranthi.guttikonda9@gmail.com>
@kranthikirang
Copy link
Author

@dlvenable I have added getIndexPattern test case as pert of integration test suite. I have followed the below steps.

`docker run --name=opendistro -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -d amazon/opendistro-for-elasticsearch:1.13.3

./gradlew :data-prepper-plugins:opensearch:integrationTest --tests "org.opensearch.dataprepper.plugins.sink.opensearch.OpenSearchIT" -Dtests.opensearch.host=localhost:9200 -Dtests.opensearch.user=admin -Dtests.opensearch.password=****
`

No issues were observed. Please take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support dynamic indexAlias through dynamic index patterns in ism policy using DP
3 participants