Skip to content

[9.5] [Streams] Create Import from other Stream flow (#275948)#280909

Open
damian-polewski wants to merge 1 commit into
elastic:9.5from
damian-polewski:backport/9.5/pr-275948
Open

[9.5] [Streams] Create Import from other Stream flow (#275948)#280909
damian-polewski wants to merge 1 commit into
elastic:9.5from
damian-polewski:backport/9.5/pr-275948

Conversation

@damian-polewski

Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.5:

Questions ?

Please refer to the Backport tool documentation

Closes elastic#267913

## Summary
- Adds an “Import from another stream” flow to reuse another stream’s
lifecycle configuration from the Data lifecycle tab.
- Keeps import behavior privilege-aware: the import action is only
available when the target stream can update both successful data
lifecycle and failure store settings.
- Avoids partial imports from sources where failure store cannot be
read: source streams without `read_failure_store` are excluded from
import candidates.

### Test plan
Run this setup in Dev Tools as an admin user:

```http
PUT _ilm/policy/logs-import-ilm-downsample-policy
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": { "max_primary_shard_size": "50gb" }
        }
      },
      "warm": {
        "min_age": "1d",
        "actions": {
          "downsample": { "fixed_interval": "1h" }
        }
      },
      "delete": {
        "min_age": "30d",
        "actions": { "delete": {} }
      }
    }
  }
}

PUT _index_template/logs-import-tsdb-template
{
  "index_patterns": ["logs.import-tsdb-*"],
  "data_stream": {},
  "template": {
    "settings": {
      "index.mode": "time_series",
      "index.routing_path": ["service.name"],
      "index.lifecycle.prefer_ilm": false
    },
    "mappings": {
      "properties": {
        "@timestamp": { "type": "date" },
        "service.name": { "type": "keyword", "time_series_dimension": true },
        "message": { "type": "match_only_text" }
      }
    }
  }
}

PUT _index_template/logs-import-standard-template
{
  "index_patterns": ["logs.import-standard-*"],
  "data_stream": {},
  "template": {
    "settings": {
      "index.lifecycle.prefer_ilm": false
    },
    "mappings": {
      "properties": {
        "@timestamp": { "type": "date" },
        "message": { "type": "match_only_text" }
      }
    }
  }
}

POST kbn:/internal/streams/_create_classic
{
  "name": "logs.import-tsdb-source-downsample",
  "description": "DSL source with downsampling",
  "ingest": {
    "lifecycle": {
      "dsl": {
        "data_retention": "30d",
        "downsample": [{ "after": "1d", "fixed_interval": "1h" }]
      }
    },
    "processing": { "steps": [] },
    "settings": {},
    "failure_store": { "lifecycle": { "enabled": { "data_retention": "14d" } } },
    "classic": {}
  }
}

POST kbn:/internal/streams/_create_classic
{
  "name": "logs.import-tsdb-source-ilm-downsample",
  "description": "ILM source with downsampling",
  "ingest": {
    "lifecycle": { "ilm": { "policy": "logs-import-ilm-downsample-policy" } },
    "processing": { "steps": [] },
    "settings": {},
    "failure_store": { "lifecycle": { "enabled": { "data_retention": "21d" } } },
    "classic": {}
  }
}

POST kbn:/internal/streams/_create_classic
{
  "name": "logs.import-tsdb-target",
  "description": "Time series target",
  "ingest": {
    "lifecycle": { "dsl": { "data_retention": "7d" } },
    "processing": { "steps": [] },
    "settings": {},
    "failure_store": { "lifecycle": { "enabled": { "data_retention": "7d" } } },
    "classic": {}
  }
}

POST kbn:/internal/streams/_create_classic
{
  "name": "logs.import-standard-target",
  "description": "Standard target",
  "ingest": {
    "lifecycle": { "dsl": { "data_retention": "7d" } },
    "processing": { "steps": [] },
    "settings": {},
    "failure_store": { "lifecycle": { "enabled": { "data_retention": "7d" } } },
    "classic": {}
  }
}
```

Then:
- Open Streams and navigate to `logs.import-tsdb-target`.
- Go to the Data lifecycle tab.
- Open the tab actions menu and click Import from another stream.
- Select `logs.import-tsdb-source-downsample` and verify the import
option shows the downsampling summary.
- Click Apply and verify the target stream imports retention,
downsampling, and failure store settings.
- Reopen the import flyout, select
`logs.import-tsdb-source-ilm-downsample`, inspect the ILM policy, and
verify the policy includes a downsample action.
- Apply the ILM source and verify the target stream uses
`logs-import-ilm-downsample-policy`.
- Navigate to `logs.import-standard-target`, import from
`logs.import-tsdb-source-downsample`, and verify downsampling is omitted
for the non-time-series target.
- Optional privilege check: test with a user that has lifecycle
privileges but no `manage_failure_store`; verify `Import from another
stream` is not shown.

### Evidence

https://github.com/user-attachments/assets/811e6b52-eed2-4426-a0f6-a6161603b8c5

<img width="859" height="823" alt="Screenshot 2026-07-10 at 13 55 04"
src="https://github.com/user-attachments/assets/b5d27440-865f-4f7e-9ca6-f038dffaa716"
/>

(cherry picked from commit 996baf8)

# Conflicts:
#	x-pack/platform/plugins/shared/streams_app/public/components/stream_management/data_management/stream_detail_management/classic.tsx
#	x-pack/platform/plugins/shared/streams_app/public/components/stream_management/data_management/stream_detail_management/lifecycle_tab_label_with_actions.test.tsx
#	x-pack/platform/plugins/shared/streams_app/public/components/stream_management/data_management/stream_detail_management/lifecycle_tab_label_with_actions.tsx
#	x-pack/platform/plugins/shared/streams_app/public/components/stream_management/data_management/stream_detail_management/wired.tsx
@damian-polewski damian-polewski added the backport This PR is a backport of another PR label Jul 25, 2026
@damian-polewski
damian-polewski enabled auto-merge (squash) July 25, 2026 11:48
@kibanamachine
kibanamachine requested review from juliaElastic and removed request for kibanamachine July 25, 2026 11:48
@damian-polewski
damian-polewski disabled auto-merge July 25, 2026 11:50
@damian-polewski
damian-polewski requested review from SoniaSanzV and removed request for juliaElastic July 25, 2026 11:50
@kibanamachine

Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Scout Lane #6 - stateful-classic / default / local-stateful-classic - Entity attachment cases – flyout add-to-case actions and Entities accordion - Entities accordion renders when entity attachments were added via API
  • [job] [logs] Scout Lane #6 - stateful-classic / default / local-stateful-classic - Entity attachment cases – flyout add-to-case actions and Entities accordion - renders no Entities accordion when a case has no entity attachments
  • [job] [logs] Scout Lane #10 - stateful-classic / default / local-stateful-classic - Onboarding UI Validation - validates main page structure and navigation

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
streamsApp 2659 2669 +10

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
streamsApp 2.2MB 2.2MB +14.0KB

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

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants