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

[Fleet] Creating a new Logstash default Output on Cloud changes Elastic Cloud agent policy output #154326

Closed
criamico opened this issue Apr 4, 2023 · 2 comments · Fixed by #154445
Assignees
Labels
Team:Fleet Team label for Observability Data Collection Fleet team v8.7.1

Comments

@criamico
Copy link
Contributor

criamico commented Apr 4, 2023

With #153226, Logstash Outputs can't be assigned anymore to policies with fleet server.
These policies get automatically assigned a default ES output instead.

However, while testing 8.7.0 on cloud I discovered that the Elastic Cloud agent policy preconfigured on Cloud, gets reassigned to the "default" ES policy instead than the Elastic Cloud internal output. This breaks the data ingest and plus it's not editable by the user.

Screenshot 2023-04-04 at 12 51 21

Screen.Recording.2023-04-04.at.12.42.43.mov

Repro steps

  1. Create a new Logstash Output and mark it as default
  2. Save it
  3. Go to app/fleet/policies/policy-elastic-agent-on-cloud/settings: Elastic Cloud agent policy has assigned default instead than Elastic Cloud internal output.
@criamico criamico added the Team:Fleet Team label for Observability Data Collection Fleet team label Apr 4, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@criamico criamico added the v8.7.1 label Apr 4, 2023
@criamico
Copy link
Contributor Author

criamico commented Apr 4, 2023

@kpollich @jen-huang I found this bug this morning while testing something related to the outputs. I think it would be good to pull it to the sprint and fix it in 8.7.1.

@criamico criamico self-assigned this Apr 5, 2023
@kpollich kpollich added the QA:Needs Validation Issue needs to be validated by QA label Apr 5, 2023
criamico added a commit that referenced this issue Apr 11, 2023
…igured policies (#154445)

Closes #154326

## Summary

After the merge of #153226, when
creating/updating a Logstash output as default, the `Elastic Cloud agent
policy` preconfigured on Cloud gets reassigned to the "default" ES
policy instead than keeping the `Elastic Cloud internal output`.

<img width="1418" alt="Screenshot 2023-04-04 at 12 51 21"
src="https://user-images.githubusercontent.com/16084106/230112067-a2767d1a-1191-4877-8dec-546d1590e41f.png">

Tee bug is fixed by checking if any given fleet server policy is
`preconfigured` or if it has already an assigned `data_output_id`, in
which cases it doesn't get updated.

### Testing
- Create an ES output additional to the default one
- Create a preconfigured fleet server policy and make sure it has
`fleet-server` integration (this is to simulate the preconfigured cloud
policy)
- Assign the previous output to the preconfigured policy
- Now create a new `logstash` output and make it default
- Check that the preconfigured policy maintains the custom output
previously assigned

### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
nchaulet pushed a commit to nchaulet/kibana that referenced this issue Apr 11, 2023
…igured policies (elastic#154445)

Closes elastic#154326

## Summary

After the merge of elastic#153226, when
creating/updating a Logstash output as default, the `Elastic Cloud agent
policy` preconfigured on Cloud gets reassigned to the "default" ES
policy instead than keeping the `Elastic Cloud internal output`.

<img width="1418" alt="Screenshot 2023-04-04 at 12 51 21"
src="https://user-images.githubusercontent.com/16084106/230112067-a2767d1a-1191-4877-8dec-546d1590e41f.png">

Tee bug is fixed by checking if any given fleet server policy is
`preconfigured` or if it has already an assigned `data_output_id`, in
which cases it doesn't get updated.

### Testing
- Create an ES output additional to the default one
- Create a preconfigured fleet server policy and make sure it has
`fleet-server` integration (this is to simulate the preconfigured cloud
policy)
- Assign the previous output to the preconfigured policy
- Now create a new `logstash` output and make it default
- Check that the preconfigured policy maintains the custom output
previously assigned

### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
(cherry picked from commit a5de314)

# Conflicts:
#	x-pack/plugins/fleet/server/services/output.test.ts
nchaulet referenced this issue Apr 12, 2023
…reconfigured policies (#154445) (#154771)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Fleet] Logstash Output - prevent updating data_output_id for
preconfigured policies
(#154445)](#154445)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"criamico@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-04-11T18:38:17Z","message":"[Fleet]
Logstash Output - prevent updating data_output_id for preconfigured
policies (#154445)\n\nCloses
https://github.com/elastic/kibana/issues/154326\r\n\r\n##
Summary\r\n\r\nAfter the merge of
#153226, when\r\ncreating/updating
a Logstash output as default, the `Elastic Cloud agent\r\npolicy`
preconfigured on Cloud gets reassigned to the \"default\" ES\r\npolicy
instead than keeping the `Elastic Cloud internal output`.\r\n\r\n<img
width=\"1418\" alt=\"Screenshot 2023-04-04 at 12 51
21\"\r\nsrc=\"https://user-images.githubusercontent.com/16084106/230112067-a2767d1a-1191-4877-8dec-546d1590e41f.png\">\r\n\r\nTee
bug is fixed by checking if any given fleet server policy
is\r\n`preconfigured` or if it has already an assigned `data_output_id`,
in\r\nwhich cases it doesn't get updated.\r\n\r\n### Testing\r\n- Create
an ES output additional to the default one\r\n- Create a preconfigured
fleet server policy and make sure it has\r\n`fleet-server` integration
(this is to simulate the preconfigured cloud\r\npolicy)\r\n- Assign the
previous output to the preconfigured policy\r\n- Now create a new
`logstash` output and make it default\r\n- Check that the preconfigured
policy maintains the custom output\r\npreviously assigned\r\n\r\n###
Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Nicolas Chaulet
<nicolas.chaulet@elastic.co>","sha":"a5de314687a195f4b73fb4b10bf6d3f7f5e58fd9","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v8.8.0"],"number":154445,"url":"https://github.com/elastic/kibana/pull/154445","mergeCommit":{"message":"[Fleet]
Logstash Output - prevent updating data_output_id for preconfigured
policies (#154445)\n\nCloses
https://github.com/elastic/kibana/issues/154326\r\n\r\n##
Summary\r\n\r\nAfter the merge of
#153226, when\r\ncreating/updating
a Logstash output as default, the `Elastic Cloud agent\r\npolicy`
preconfigured on Cloud gets reassigned to the \"default\" ES\r\npolicy
instead than keeping the `Elastic Cloud internal output`.\r\n\r\n<img
width=\"1418\" alt=\"Screenshot 2023-04-04 at 12 51
21\"\r\nsrc=\"https://user-images.githubusercontent.com/16084106/230112067-a2767d1a-1191-4877-8dec-546d1590e41f.png\">\r\n\r\nTee
bug is fixed by checking if any given fleet server policy
is\r\n`preconfigured` or if it has already an assigned `data_output_id`,
in\r\nwhich cases it doesn't get updated.\r\n\r\n### Testing\r\n- Create
an ES output additional to the default one\r\n- Create a preconfigured
fleet server policy and make sure it has\r\n`fleet-server` integration
(this is to simulate the preconfigured cloud\r\npolicy)\r\n- Assign the
previous output to the preconfigured policy\r\n- Now create a new
`logstash` output and make it default\r\n- Check that the preconfigured
policy maintains the custom output\r\npreviously assigned\r\n\r\n###
Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Nicolas Chaulet
<nicolas.chaulet@elastic.co>","sha":"a5de314687a195f4b73fb4b10bf6d3f7f5e58fd9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/154445","number":154445,"mergeCommit":{"message":"[Fleet]
Logstash Output - prevent updating data_output_id for preconfigured
policies (#154445)\n\nCloses
https://github.com/elastic/kibana/issues/154326\r\n\r\n##
Summary\r\n\r\nAfter the merge of
#153226, when\r\ncreating/updating
a Logstash output as default, the `Elastic Cloud agent\r\npolicy`
preconfigured on Cloud gets reassigned to the \"default\" ES\r\npolicy
instead than keeping the `Elastic Cloud internal output`.\r\n\r\n<img
width=\"1418\" alt=\"Screenshot 2023-04-04 at 12 51
21\"\r\nsrc=\"https://user-images.githubusercontent.com/16084106/230112067-a2767d1a-1191-4877-8dec-546d1590e41f.png\">\r\n\r\nTee
bug is fixed by checking if any given fleet server policy
is\r\n`preconfigured` or if it has already an assigned `data_output_id`,
in\r\nwhich cases it doesn't get updated.\r\n\r\n### Testing\r\n- Create
an ES output additional to the default one\r\n- Create a preconfigured
fleet server policy and make sure it has\r\n`fleet-server` integration
(this is to simulate the preconfigured cloud\r\npolicy)\r\n- Assign the
previous output to the preconfigured policy\r\n- Now create a new
`logstash` output and make it default\r\n- Check that the preconfigured
policy maintains the custom output\r\npreviously assigned\r\n\r\n###
Checklist\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Nicolas Chaulet
<nicolas.chaulet@elastic.co>","sha":"a5de314687a195f4b73fb4b10bf6d3f7f5e58fd9"}}]}]
BACKPORT-->

---------

Co-authored-by: Cristina Amico <criamico@users.noreply.github.com>
@amolnater-qasource amolnater-qasource removed the QA:Needs Validation Issue needs to be validated by QA label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Team label for Observability Data Collection Fleet team v8.7.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants