Skip to content

[Response Ops][Reporting] Scheduled Reports - Audit Logging (merging into feature branch)#221846

Merged
ymao1 merged 147 commits intoelastic:scheduled-reportsfrom
ymao1:scheduled-reports-audit
Jun 15, 2025
Merged

[Response Ops][Reporting] Scheduled Reports - Audit Logging (merging into feature branch)#221846
ymao1 merged 147 commits intoelastic:scheduled-reportsfrom
ymao1:scheduled-reports-audit

Conversation

@ymao1
Copy link
Copy Markdown
Contributor

@ymao1 ymao1 commented May 28, 2025

Towards #216313

Note

This PR will be merged into a feature branch

Summary

Logs audit events when users use the schedule/list/disable scheduled reports APIs

To Verify

  1. Set xpack.security.audit.enabled: true in Kibana config and start ES and Kibana
  2. Use the API to schedule some reports and then list and disable using the API

For example:

POST kbn:/internal/reporting/schedule/printablePdfV2
{
    "schedule": {
        "rrule": {
            "freq": 3,
            "interval": 1,
            "byhour": [0,1,2],
            "byminute": [50,55]
        }
    },
    "jobParams":"(browserTimezone:America/New_York,layout:(dimensions:(height:2220,width:1409),id:preserve_layout),locatorParams:!((id:DASHBOARD_APP_LOCATOR,params:(dashboardId:edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b,preserveSavedFilters:!t,timeRange:(from:now-7d/d,to:now),useHash:!f,viewMode:view))),objectType:dashboard,title:'[Logs] Web Traffic',version:'9.1.0')"
}

GET kbn:/internal/reporting/scheduled/list

PATCH kbn:/internal/reporting/scheduled/bulk_disable
{
    "ids": ["<reportId>"]
}
  1. In your kibana folder, go to logs/audit.log. You should be able to see some audit events logged, for example
{"event":{"action":"scheduled_report_schedule","category":["database"],"type":["creation"],"outcome":"unknown"},"kibana":{"space_id":"default","session_id":"m82PsJ/ryDwhpCtaoQQkFSjEthWTlMshadIeMY5l+Ww=","saved_object":{"type":"scheduled_report","id":"c871e247-5dd4-4f0a-8419-e70eb184645a","name":"PDF"}},"user":{"id":"u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0","name":"elastic","roles":["superuser"]},"trace":{"id":"e255102c-6ef9-4264-9cbd-9333a0910577"},"client":{"ip":"127.0.0.1"},"service":{"node":{"roles":["background_tasks","ui"]}},"ecs":{"version":"8.11.0"},"@timestamp":"2025-06-10T15:06:55.369-04:00","message":"User is creating scheduled report [id=c871e247-5dd4-4f0a-8419-e70eb184645a] [name=PDF]","log":{"level":"INFO","logger":"plugins.security.audit.ecs"},"process":{"pid":95125,"uptime":359.058969666},"transaction":{"id":"1fd4a03b23a4ad0d"}}
{"event":{"action":"scheduled_report_list","category":["database"],"type":["access"],"outcome":"success"},"kibana":{"space_id":"default","session_id":"m82PsJ/ryDwhpCtaoQQkFSjEthWTlMshadIeMY5l+Ww=","saved_object":{"type":"scheduled_report","id":"5f878787-1ea3-4704-b43c-b25e27376e5a"}},"user":{"id":"u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0","name":"elastic","roles":["superuser"]},"trace":{"id":"7fc9d281-ea86-4d1b-b9f2-8f2143d058e0"},"client":{"ip":"127.0.0.1"},"service":{"node":{"roles":["background_tasks","ui"]}},"ecs":{"version":"8.11.0"},"@timestamp":"2025-06-10T15:13:03.960-04:00","message":"User has accessed scheduled report [id=5f878787-1ea3-4704-b43c-b25e27376e5a]","log":{"level":"INFO","logger":"plugins.security.audit.ecs"},"process":{"pid":95125,"uptime":727.648898875},"transaction":{"id":"bb9eabc53740c18c"}}

ersin-erdal and others added 30 commits April 9, 2025 18:38
…:ersin-erdal/kibana into 216308-support-rrule-for-task-scheduling
… src/core/server/integration_tests/ci_checks'
…:ersin-erdal/kibana into 216308-support-rrule-for-task-scheduling
…:ersin-erdal/kibana into 216308-support-rrule-for-task-scheduling
… src/core/server/integration_tests/ci_checks'
…:ersin-erdal/kibana into 216308-support-rrule-for-task-scheduling
@ymao1 ymao1 changed the title [Response Ops][Reporting] Scheduled Reports - Audit Logging [Response Ops][Reporting] Scheduled Reports - Audit Logging (merging into feature branch) Jun 10, 2025
@ymao1 ymao1 self-assigned this Jun 10, 2025
@ymao1 ymao1 requested review from js-jankisalvi and pmuellr June 11, 2025 00:03
@ymao1 ymao1 marked this pull request as ready for review June 11, 2025 00:03
@ymao1 ymao1 requested a review from a team as a code owner June 11, 2025 00:03
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #18 / Entity Analytics - Entity Store @ess Host transform logic Install Entity Store and test Host transform "before each" hook for "Should return 200 and status 'running' for all engines"

Metrics [docs]

✅ unchanged

History

cc @ymao1

Copy link
Copy Markdown
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

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

Verified locally, works as expected 👍

Copy link
Copy Markdown
Contributor

@doakalexi doakalexi left a comment

Choose a reason for hiding this comment

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

LGTM! tested locally and works as expected

@ymao1 ymao1 merged commit f2782b0 into elastic:scheduled-reports Jun 15, 2025
9 of 10 checks passed
@ymao1 ymao1 deleted the scheduled-reports-audit branch June 15, 2025 17:04
ymao1 added a commit that referenced this pull request Jun 19, 2025
Resolves #216313

## Summary

This is a feature branch that contains the following commits. Each
individual linked PR contains a summary and verification instructions.

* Schedule API - #219771
* Scheduled report task runner -
#219770
* List and disable API - #220922
* Audit logging - #221846
* Send scheduled report emails -
#220539
* Commit to check license -
f5f9d9d
* Update to list API response format -
#224262

---------

Co-authored-by: Ersin Erdal <ersin.erdal@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Ersin Erdal <92688503+ersin-erdal@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Alexi Doak <109488926+doakalexi@users.noreply.github.com>
ymao1 added a commit to ymao1/kibana that referenced this pull request Jun 20, 2025
Resolves elastic#216313

## Summary

This is a feature branch that contains the following commits. Each
individual linked PR contains a summary and verification instructions.

* Schedule API - elastic#219771
* Scheduled report task runner -
elastic#219770
* List and disable API - elastic#220922
* Audit logging - elastic#221846
* Send scheduled report emails -
elastic#220539
* Commit to check license -
elastic@f5f9d9d
* Update to list API response format -
elastic#224262

---------

Co-authored-by: Ersin Erdal <ersin.erdal@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Ersin Erdal <92688503+ersin-erdal@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Alexi Doak <109488926+doakalexi@users.noreply.github.com>
(cherry picked from commit a409627)

# Conflicts:
#	src/platform/packages/private/kbn-reporting/common/routes.ts
#	x-pack/platform/plugins/private/canvas/server/feature.test.ts
#	x-pack/platform/plugins/private/reporting/server/core.ts
#	x-pack/platform/plugins/private/reporting/server/features.ts
#	x-pack/platform/plugins/shared/features/server/__snapshots__/oss_features.test.ts.snap
#	x-pack/platform/test/api_integration/apis/features/features/features.ts
#	x-pack/test_serverless/api_integration/test_suites/chat/platform_security/authorization.ts
#	x-pack/test_serverless/api_integration/test_suites/observability/platform_security/authorization.ts
#	x-pack/test_serverless/api_integration/test_suites/search/platform_security/authorization.ts
#	x-pack/test_serverless/api_integration/test_suites/security/platform_security/authorization.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants