-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Agent logs to show link to discover for security projects #167976
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
...c/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx
Outdated
Show resolved
Hide resolved
I'd really like to find a way to retain the Logs view in Fleet. There has been work to try to maintain this but it seems that something got broken along the way:
@tonyghiani could you help us figure out how we can get this working again in Fleet on Security projects? |
Hey @joshdover, happy to help, could you just expand a bit more on what seems not to work anymore, please? The tickets you mentioned were about decoupling the LogStream component and logic to be reused in Fleet and other consumers, has it stopped working? |
@tonyghiani Please see the bug that this PR closes: #167304. We're seeing 500s on requests to |
Yes we were seeing this error:
|
@juliaElastic and I will continue the conversation offline to debug the issue. I understand what the issue root is, we just need to validate it. |
Created a security project in qa to debug, and the logging view is working now, not sure when this was fixed but it seems there is no issue: https://jb-test-security-ffef54.kb.eu-west-1.aws.qa.elastic.cloud/app/fleet/agents/1d0afeb8-7081-4d16-a485-553557fa2574/logs Tested locally with kibana serverless-security, and it works there too. Only the |
Yes, SGTM |
@juliaElastic @joshdover should this link go to the new Log Explorer experience based on Discover instead of navigating to normal Discover? If on the security serverless project the |
Thanks for the suggestion, though Log Explorer is not available in security projects. |
Pinging @elastic/fleet (Team:Fleet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thank you for the tests. 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I did not see that you were trying to use that capabilities
settings from the client, you will have to whitelist it so it can be use here
This was it, thanks! It works locally after adding here. |
Updated to show Open in Discover for observability project too, see reasoning here. |
@@ -119,6 +120,8 @@ export const AgentLogsUI: React.FunctionComponent<AgentLogsProps> = memo( | |||
({ agent, agentPolicy, state }) => { | |||
const { data, application, http } = useStartServices(); | |||
const { update: updateState } = AgentLogsUrlStateHelper.useTransitions(); | |||
const config = useConfig(); | |||
const isLogsUIAvailable = !config.internal?.registry?.capabilities; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use the cloud plugin isServerlessEnabled
method instead of that condition it could be more robust, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, I tested by setting xpack.cloud.serverless.project_id: "1234"
in serverless.yml, as the flag is based on that
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
…astic#167976) ## Summary Closes elastic#167304 Show `Open in Discover` button instead of `Open in Logs` in security serverless projects. To verify: - Start es and kibana locally in serverless mode ``` yarn es serverless --kill yarn serverless-security # Login with username elastic_serverless or system_indices_superuser and password changeme ``` - Start fleet-server locally with the fleet-server-dev service token: ``` # add to fleet-server.yml output: elasticsearch: hosts: "http://localhost:9200" service_token: AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL2ZsZWV0LXNlcnZlci1kZXY6VVo1TWd6MnFTX3FVTWliWGNXNzlwQQ # build fleet-server SNAPSHOT=true DEV=true make release-darwin/amd64 # start fleet-server ./build/binaries/fleet-server-8.11.0-SNAPSHOT-darwin-x86_64/fleet-server -c fleet-server.yml ``` - enroll an agent (or create a fake `.fleet-agents` doc) - go to Agent details and check that instead of `Open in Logs` there is a button `Open in Discover` I have used the capabilities list from `serverless.{type}.yml` which is set to security/observability in the corresponding project types, but for some reason the capabilities list is not populated. @nchaulet any idea why those configs are not picked up? Getting this on the UI: ``` agent_logs.tsx:87 { "internal": { "fleetServerStandalone": true, "disableProxies": true, "activeAgentsSoftLimit": 25000, "onlyAllowAgentUpgradeToKnownVersions": true }, "agents": { "enabled": true }, "developer": {}, "enableExperimental": [] } ``` Agent logs view in security project: <img width="1346" alt="image" src="https://github.com/elastic/kibana/assets/90178898/a900c8a3-51d7-4e1a-8848-426352b39246"> Button navigates to Discover with these filters: Data is populated with a real agent <img width="1775" alt="image" src="https://github.com/elastic/kibana/assets/90178898/a51b3d19-04eb-49a9-9018-308737757b1d"> ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [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
…astic#171525) Fixes elastic#168349 ## Summary Fix links to Logs view to point to Discover in Serverless. As the Logs view UI is not available in serverless, the "Open in logs" buttons should point to Discover instead. Rather than hardcode the url in each of the places where is needed, I extracted a small component that builds the two urls and allows switching in an easier way. If in the future on of the two links will go away, it will be easier to find those occurrences. ### Testing Test for serverless following [these instructions](elastic#167976) **Error logs in agent activity flyout** - Enroll an agent and try to cause some error - for instance upgrading an agent that is not upgradeable - Click on "Agent Activity" and find the error and a button besides it - On stateful the button says "Open in Logs" ![Screenshot 2023-11-20 at 13 07 08](https://github.com/elastic/kibana/assets/16084106/704cf0e2-c7ee-4751-9e7f-7dcd263a5aa4) - On serverless is "Open in discover" ![Screenshot 2023-11-20 at 13 08 02](https://github.com/elastic/kibana/assets/16084106/3902f09e-93dc-48d3-867e-1f80d977f437) - Check that both show the same logs: ![Screenshot 2023-11-16 at 11 49 24](https://github.com/elastic/kibana/assets/16084106/d863d99f-0c70-45e5-9316-a37645464c34) ![Screenshot 2023-11-16 at 11 48 54](https://github.com/elastic/kibana/assets/16084106/7cbd0a5f-3b31-4c4d-a4b7-4eb7390983c8) **Agent logs** (Same test as above) - Enroll an agent - Click on the agent and go to the "Logs" tab - On stateful the button says "Open in Logs" ![Screenshot 2023-11-20 at 13 04 41](https://github.com/elastic/kibana/assets/16084106/6a43a062-37db-47ea-819f-acd170439395) - On serverless is "Open in discover" ![Screenshot 2023-11-20 at 13 04 11](https://github.com/elastic/kibana/assets/16084106/e15fdc8b-8780-4ac6-afc6-bff3d3a96be5) - Check that both show the same logs **Custom Logs UI** There is also a link to logs on custom logs UI but I just linked to discover for that one: https://github.com/elastic/kibana/pull/171525/files#diff-e337aa916d60d0d1033e3298c8c9c33c6a6fcd87a8ded971a4a87f5ccfc0981fR20-R22 --------- Co-authored-by: Kibana Machine <[email protected]>
Summary
Closes #167304
Show
Open in Discover
button instead ofOpen in Logs
in security serverless projects.To verify:
.fleet-agents
doc)Open in Logs
there is a buttonOpen in Discover
I have used the capabilities list from
serverless.{type}.yml
which is set to security/observability in the corresponding project types, but for some reason the capabilities list is not populated. @nchaulet any idea why those configs are not picked up?Getting this on the UI:
Agent logs view in security project:
Button navigates to Discover with these filters:
Data is populated with a real agent
Checklist
Delete any items that are not applicable to this PR.