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

[Winlogbeat] Convert dashboards for Kibana 8.x #37085

Merged

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented Nov 10, 2023

Proposed commit message

I loaded the dashboards into Kibana 8.11.0 and then exported them. This removed the migrationVersion which was causing problems for users of multiple Kibana spaces. I had to fix one visualization on the overview dashboard. Other than that, I did not make any changes to the dashboard visualizations or layouts.

These are the commands that I used:

elastic-package stack up -d -v --version 8.11.0

cd x-pack/winlogbeat

export KIBANA_INSECURE=true 
export KIBANA_URL="https://elastic:changeme@localhost:5601" 

mage -v dashboards:import

for module in powershell security sysmon; do
  for id in $(jq -r .id module/$module/_meta/kibana/7/dashboard/*.json); do 
    MODULE=$module ID=$id mage dashboards:export
  done
done

git add module/*/_meta/kibana/8
git rm -r module/*/_meta/kibana/7

cd ../../winlogbeat
go run ../dev-tools/cmd/dashboards/export_dashboards.go -kibana="https://elastic:changeme@localhost:5601" -folder . -insecure -dashboard Winlogbeat-Dashboard-ecs
git rm -r _meta/kibana/7

I discovered that libbeat has hard-coded the Kibana dashboard directory to 7. So after exporting the visualizations I renamed the directory from 8 back to 7 so that Winlogbeat will continue to load the dashboards on setup.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

Migrate the saved dashboards to 8.x format.

[git-generate]
cd x-pack/winlogbeat

export KIBANA_INSECURE=true
export KIBANA_URL="https://elastic:changeme@localhost:5601"

mage dashboards:import

for module in powershell security sysmon; do
  for id in $(jq -r .id module/$module/_meta/kibana/7/dashboard/*.json); do
    MODULE=$module ID=$id mage dashboards:export
  done
done

git add module/*/_meta/kibana/8
git rm -r module/*/_meta/kibana/7

cd ../../winlogbeat
go run ../dev-tools/cmd/dashboards/export_dashboards.go -kibana="https://elastic:changeme@localhost:5601" -folder . -insecure -dashboard Winlogbeat-Dashboard-ecs
git rm -r _meta/kibana/7
The libbeat code that loads dashboards is hard-coded to look into
the "7" directory.
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Nov 10, 2023
@andrewkroh andrewkroh added bug Winlogbeat :Dashboards Team:Security-External Integrations and removed needs_team Indicates that the issue/PR needs a Team:* label labels Nov 10, 2023
Copy link
Contributor

mergify bot commented Nov 10, 2023

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @andrewkroh? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@andrewkroh andrewkroh marked this pull request as ready for review November 10, 2023 19:56
@andrewkroh andrewkroh requested review from a team as code owners November 10, 2023 19:56
@andrewkroh andrewkroh requested review from belimawr and rdner November 10, 2023 19:56
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@pierrehilbert pierrehilbert added the Team:Elastic-Agent Label for the Agent team label Nov 10, 2023
@elasticmachine
Copy link
Collaborator

elasticmachine commented Nov 10, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-11-10T19:56:50.172+0000

  • Duration: 138 min 58 sec

Test stats 🧪

Test Results
Failed 0
Passed 28668
Skipped 2015
Total 30683

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to explain what the issue was with the "Number of Events Over Time By Channel" visualization.

@andrewkroh
Copy link
Member Author

I wanted to include a copy of the error, but I forgot to copy it before fixing it. But it was something about a property of the x-axis not being valid. When I edited and resaved it went away.

@andrewkroh andrewkroh merged commit 17d5bb1 into elastic:main Nov 14, 2023
@andrewkroh andrewkroh added the backport-v8.11.0 Automated backport with mergify label Nov 14, 2023
mergify bot pushed a commit that referenced this pull request Nov 14, 2023
Migrate the saved dashboards to 8.x format.

The libbeat code that loads dashboards is hard-coded to look into the "7" directory. So I renamed the 8 dir back to 7.

Fix "Number of Events Over Time By Channel" visualization. One attribute related to the axis was giving an error. Editing and re-saving fixed it.

[git-generate]
cd x-pack/winlogbeat

export KIBANA_INSECURE=true
export KIBANA_URL="https://elastic:changeme@localhost:5601"

mage dashboards:import

for module in powershell security sysmon; do
  for id in $(jq -r .id module/$module/_meta/kibana/7/dashboard/*.json); do
    MODULE=$module ID=$id mage dashboards:export
  done
done

git add module/*/_meta/kibana/8
git rm -r module/*/_meta/kibana/7

cd ../../winlogbeat
go run ../dev-tools/cmd/dashboards/export_dashboards.go -kibana="https://elastic:changeme@localhost:5601" -folder . -insecure -dashboard Winlogbeat-Dashboard-ecs
git rm -r _meta/kibana/7

(cherry picked from commit 17d5bb1)
shmsr pushed a commit that referenced this pull request Dec 7, 2023
Migrate the saved dashboards to 8.x format.

The libbeat code that loads dashboards is hard-coded to look into the "7" directory. So I renamed the 8 dir back to 7.

Fix "Number of Events Over Time By Channel" visualization. One attribute related to the axis was giving an error. Editing and re-saving fixed it.

[git-generate]
cd x-pack/winlogbeat

export KIBANA_INSECURE=true
export KIBANA_URL="https://elastic:changeme@localhost:5601"

mage dashboards:import

for module in powershell security sysmon; do
  for id in $(jq -r .id module/$module/_meta/kibana/7/dashboard/*.json); do
    MODULE=$module ID=$id mage dashboards:export
  done
done

git add module/*/_meta/kibana/8
git rm -r module/*/_meta/kibana/7

cd ../../winlogbeat
go run ../dev-tools/cmd/dashboards/export_dashboards.go -kibana="https://elastic:changeme@localhost:5601" -folder . -insecure -dashboard Winlogbeat-Dashboard-ecs
git rm -r _meta/kibana/7

(cherry picked from commit 17d5bb1)

Co-authored-by: Andrew Kroh <[email protected]>
Scholar-Li pushed a commit to Scholar-Li/beats that referenced this pull request Feb 5, 2024
Migrate the saved dashboards to 8.x format.

The libbeat code that loads dashboards is hard-coded to look into the "7" directory. So I renamed the 8 dir back to 7.

Fix "Number of Events Over Time By Channel" visualization. One attribute related to the axis was giving an error. Editing and re-saving fixed it. 

[git-generate]
cd x-pack/winlogbeat

export KIBANA_INSECURE=true
export KIBANA_URL="https://elastic:changeme@localhost:5601"

mage dashboards:import

for module in powershell security sysmon; do
  for id in $(jq -r .id module/$module/_meta/kibana/7/dashboard/*.json); do
    MODULE=$module ID=$id mage dashboards:export
  done
done

git add module/*/_meta/kibana/8
git rm -r module/*/_meta/kibana/7

cd ../../winlogbeat
go run ../dev-tools/cmd/dashboards/export_dashboards.go -kibana="https://elastic:changeme@localhost:5601" -folder . -insecure -dashboard Winlogbeat-Dashboard-ecs
git rm -r _meta/kibana/7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.11.0 Automated backport with mergify bug :Dashboards Team:Elastic-Agent Label for the Agent team Winlogbeat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BEAT] Winlogbeat in 8.9.2 / multiple Spaces / Dashboard same in Winlogbeat 8.10.0-8.10.1
5 participants