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

Custom index patterns not fully handled by dashboards #21232

Closed
andrewkroh opened this issue Sep 22, 2020 · 2 comments · Fixed by #27901
Closed

Custom index patterns not fully handled by dashboards #21232

andrewkroh opened this issue Sep 22, 2020 · 2 comments · Fixed by #27901

Comments

@andrewkroh
Copy link
Member

There are two parts that are not being updated when setting a custom index pattern via setup.dashboards.index.

  1. Timelion expressions containing index patterns are not updated. example
  2. index-pattern references from dashboard objects are not updated. example

Regarding timelion, there's no code to update the expression with the new index pattern. I think that would belong in

func ReplaceIndexInVisState(index string, visStateJSON string) string {
var visState map[string]interface{}
err := json.Unmarshal([]byte(visStateJSON), &visState)
if err != nil {
logp.Err("Fail to unmarshal visState: %v", err)
return visStateJSON
}
params, ok := visState["params"].(map[string]interface{})
if !ok {
return visStateJSON
}
// Don't set it if it was not set before
if pattern, ok := params["index_pattern"].(string); !ok || len(pattern) == 0 {
return visStateJSON
}
params["index_pattern"] = index
d, err := json.Marshal(visState)
if err != nil {
logp.Err("Fail to marshal visState: %v", err)
return visStateJSON
}
return string(d)
}

And for the dashboard objects we need to update the references where type=index-pattern. I think that would belong in

for i, object := range objects {

Relates

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 22, 2020
@andresrc andresrc added the Team:Services (Deprecated) Label for the former Integrations-Services team label Sep 23, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Sep 23, 2020
@andresrc andresrc added Team:Elastic-Agent Label for the Agent team and removed Team:Services (Deprecated) Label for the former Integrations-Services team labels Feb 15, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

kvch added a commit that referenced this issue Sep 15, 2021
…ds.index` is set (#27901)

## What does this PR do?

This PR adds a new check to `make check` to make sure all dashboards can handle custom index names. It is the responsibility of the dashboard author to keep the dashboard useable if `setup.dashboards.index` is configured.

The PR contains additional fixes to make sure existing dashboards can be used with custom index names. Also, the test coverage was increased as it is a quite big PR.

The PR also decodes a few fields to make dashboards easier to review.

## Why is it important?

The bug prevents users from setting custom index names and use our dashboards at the same time.

Closes #21232
mergify bot pushed a commit that referenced this issue Sep 15, 2021
…ds.index` is set (#27901)

## What does this PR do?

This PR adds a new check to `make check` to make sure all dashboards can handle custom index names. It is the responsibility of the dashboard author to keep the dashboard useable if `setup.dashboards.index` is configured.

The PR contains additional fixes to make sure existing dashboards can be used with custom index names. Also, the test coverage was increased as it is a quite big PR.

The PR also decodes a few fields to make dashboards easier to review.

## Why is it important?

The bug prevents users from setting custom index names and use our dashboards at the same time.

Closes #21232

(cherry picked from commit 2328548)

# Conflicts:
#	libbeat/dashboards/modify_json.go
kvch added a commit that referenced this issue Sep 15, 2021
…ds.index` is set (#27901)

This PR adds a new check to `make check` to make sure all dashboards can handle custom index names. It is the responsibility of the dashboard author to keep the dashboard useable if `setup.dashboards.index` is configured.

The PR contains additional fixes to make sure existing dashboards can be used with custom index names. Also, the test coverage was increased as it is a quite big PR.

The PR also decodes a few fields to make dashboards easier to review.

The bug prevents users from setting custom index names and use our dashboards at the same time.

Closes #21232

(cherry picked from commit 2328548)
kvch added a commit that referenced this issue Sep 15, 2021
…ds.index` is set (#27901) (#27932)

This PR adds a new check to `make check` to make sure all dashboards can handle custom index names. It is the responsibility of the dashboard author to keep the dashboard useable if `setup.dashboards.index` is configured.

The PR contains additional fixes to make sure existing dashboards can be used with custom index names. Also, the test coverage was increased as it is a quite big PR.

The PR also decodes a few fields to make dashboards easier to review.

The bug prevents users from setting custom index names and use our dashboards at the same time.

Closes #21232

(cherry picked from commit 2328548)

Co-authored-by: Noémi Ványi <[email protected]>
Icedroid pushed a commit to Icedroid/beats that referenced this issue Nov 1, 2021
…ds.index` is set (elastic#27901)

## What does this PR do?

This PR adds a new check to `make check` to make sure all dashboards can handle custom index names. It is the responsibility of the dashboard author to keep the dashboard useable if `setup.dashboards.index` is configured.

The PR contains additional fixes to make sure existing dashboards can be used with custom index names. Also, the test coverage was increased as it is a quite big PR.

The PR also decodes a few fields to make dashboards easier to review.

## Why is it important?

The bug prevents users from setting custom index names and use our dashboards at the same time.

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

Successfully merging a pull request may close this issue.

4 participants