Opensearch sink with index template makes dataprepper fails dataprepper to start

I have the latest Opensearch/Dataprepper (2.18).

This pipeline works fine without this directives
template_type: index-template
template_content: >

sink:
    - opensearch:
        hosts: [ https://...... ]
        insecure: true
        username: "...."
        password: "....."
        index: syslog-standard
        dlq_file: "/usr/share/data-prepper/pipelines/dlq_syslog.err"
        template_type: index-template
        template_content: >
          {
            "template" : {
                  "mappings" : {
                          "properties": {
                                  "logsource": { "type" : "text" },
                                  "program": { "type" : "text" },
                                  "pid": { "type" : "text" },
                                  "timestampOriginalString": { "type" : "text" },
                                  "message": { "type" : "wildcard" }
                          }
                  }
            }
          }

But with them included I got errors in dataprepper logs:

2025-02-03T13:20:28,398 [syslog-pipeline-sink-worker-4-thread-1] WARN  org.opensearch.dataprepper.plugins.sink.opensearch.OpenSearchSink - Failed to initialize OpenSearch sink, retrying: Forbidden access
2025-02-03T13:20:28,602 [syslog-pipeline-sink-worker-4-thread-1] INFO  org.opensearch.dataprepper.pipeline.Pipeline - Pipeline [syslog-pipeline] - sink is not ready for execution, retrying
2025-02-03T13:20:28,603 [syslog-pipeline-sink-worker-4-thread-1] INFO  org.opensearch.dataprepper.plugins.sink.opensearch.OpenSearchSink - Initializing OpenSearch sink
2025-02-03T13:20:28,603 [syslog-pipeline-sink-worker-4-thread-1] INFO  org.opensearch.dataprepper.plugins.sink.opensearch.ConnectionConfiguration - Using the username provided in the config.
2025-02-03T13:20:28,603 [syslog-pipeline-sink-worker-4-thread-1] INFO  org.opensearch.dataprepper.plugins.sink.opensearch.ConnectionConfiguration - Using the trust all strategy

Why?

Update: because of user permissions… The user I used (not admin) had enough rights to create index, but not for template creation. When I used admin user, it started to work.
P.

@dlv - do you have any idea why this would require admin permissions? Is this a setting that can be adjusted? thanks

1 Like

It makes sense. Out of the box (see screenie below) it looks like only admin has access to create an index template (/index_template/put). You may want to create a role that has the permission to do that and then assign your user to that role.

2 Likes

@piotrfrq,

Yes, you will need permissions to put an index template as @nateynate suggested.

Alternatively, you can choose not to create the index template in Data Prepper.

We do not currently have a specific role with scoped down Data Prepper permissions. We have an open issue to support it, but haven’t made any specific work towards it.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.