From 59320bb60b75d237c0aaa2eefb41f0e9df204d85 Mon Sep 17 00:00:00 2001 From: divyaac Date: Thu, 6 Jun 2024 14:58:54 -0700 Subject: [PATCH] Deprecated default_report_months (#27350) * Deprecated default_report_months through docs and upgrade guides * Added upgraade doc * Update website/content/docs/upgrading/upgrade-to-1.18.x.mdx Co-authored-by: Mike Palmiotto * Update website/content/api-docs/system/internal-counters.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Update website/content/docs/upgrading/upgrade-to-1.18.x.mdx Co-authored-by: Mike Palmiotto * Update vault/logical_system_activity.go Co-authored-by: Mike Palmiotto * updated code sample * Added changelog * Update website/content/docs/upgrading/upgrade-to-1.18.x.mdx Co-authored-by: Mike Palmiotto * Update changelog/27350.txt Co-authored-by: Mike Palmiotto * Update website/content/docs/upgrading/index.mdx Co-authored-by: Mike Palmiotto * Update upgrade-to-1.18.x.mdx * Update upgrade-to-1.18.x.mdx * Added docs nav * Edited docs nav * Edited docs --------- Co-authored-by: Mike Palmiotto Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> --- changelog/27350.txt | 4 ++ vault/activity_log.go | 1 + vault/activity_log_test.go | 1 - vault/logical_system_activity.go | 6 +-- .../api-docs/system/internal-counters.mdx | 5 +-- .../docs/upgrading/upgrade-to-1.18.x.mdx | 38 +++++++++++++++++++ website/data/docs-nav-data.json | 4 ++ 7 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 changelog/27350.txt create mode 100644 website/content/docs/upgrading/upgrade-to-1.18.x.mdx diff --git a/changelog/27350.txt b/changelog/27350.txt new file mode 100644 index 0000000000..ddf95bc005 --- /dev/null +++ b/changelog/27350.txt @@ -0,0 +1,4 @@ +```release-note:change +activity log: Deprecated the field "default_report_months". Instead, the billing start time will be used to determine the start time +when querying the activity log endpoints. +``` \ No newline at end of file diff --git a/vault/activity_log.go b/vault/activity_log.go index 1c98d3122d..9aab39684b 100644 --- a/vault/activity_log.go +++ b/vault/activity_log.go @@ -1993,6 +1993,7 @@ func (a *ActivityLog) modifyResponseMonths(months []*ResponseMonth, start time.T type activityConfig struct { // DefaultReportMonths are the default number of months that are returned on // a report. The zero value uses the system default of 12. + // Deprecated: This field was removed in favor of using different default startTime and endTime values DefaultReportMonths int `json:"default_report_months"` // RetentionMonths defines the number of months we want to retain data. The diff --git a/vault/activity_log_test.go b/vault/activity_log_test.go index 733b6dc10e..620ce6f634 100644 --- a/vault/activity_log_test.go +++ b/vault/activity_log_test.go @@ -1016,7 +1016,6 @@ func TestActivityLog_API_ConfigCRUD_Census(t *testing.T) { } expected := map[string]interface{}{ - "default_report_months": 12, "retention_months": 56, "enabled": "enable", "queries_available": false, diff --git a/vault/logical_system_activity.go b/vault/logical_system_activity.go index f7607a191c..8eeeb24ad3 100644 --- a/vault/logical_system_activity.go +++ b/vault/logical_system_activity.go @@ -108,6 +108,7 @@ func (b *SystemBackend) rootActivityPaths() []*framework.Path { Type: framework.TypeInt, Default: 12, Description: "Number of months to report if no start date specified.", + Deprecated: true, }, "retention_months": { Type: framework.TypeInt, @@ -328,7 +329,6 @@ func (b *SystemBackend) handleActivityConfigRead(ctx context.Context, req *logic return &logical.Response{ Data: map[string]interface{}{ - "default_report_months": config.DefaultReportMonths, "retention_months": config.RetentionMonths, "enabled": config.Enabled, "queries_available": qa, @@ -358,8 +358,8 @@ func (b *SystemBackend) handleActivityConfigUpdate(ctx context.Context, req *log { // Parse the default report months - if defaultReportMonthsRaw, ok := d.GetOk("default_report_months"); ok { - config.DefaultReportMonths = defaultReportMonthsRaw.(int) + if _, ok := d.GetOk("default_report_months"); ok { + warnings = append(warnings, fmt.Sprintf("default_report_months is deprecated: defaulting to billing start time")) } if config.DefaultReportMonths <= 0 { diff --git a/website/content/api-docs/system/internal-counters.mdx b/website/content/api-docs/system/internal-counters.mdx index d19e4a5417..69be0d763d 100644 --- a/website/content/api-docs/system/internal-counters.mdx +++ b/website/content/api-docs/system/internal-counters.mdx @@ -1095,7 +1095,8 @@ The `/sys/internal/counters/config` endpoint is used to configure logging of act ### Parameters -- `default_report_months` `(integer: 12)` - The number of months to report if no `start_time` is specified in a query. +- `default_report_months` `(integer: 12)` - **DEPRECATED** The number + of months to report if no `start_time` is specified in a query. - `enabled` `(string: enable, disable, default)` - Enable or disable counting of client activity. When set to `default`, the client counts are enabled on Enterprise builds and disabled on community builds. Disabling the feature during the middle of a month will discard any data recorded for that month, but does not delete previous months. @@ -1108,7 +1109,6 @@ Any missing parameters are left at their existing value. ```json { "enabled": "enable", - "default_report_months": 3, "retention_months": 54 } ``` @@ -1153,7 +1153,6 @@ $ curl \ "lease_duration": 0, "renewable": false, "data": { - "default_report_months": 12, "enabled": "default-enabled", "queries_available": true, "retention_months": 48, diff --git a/website/content/docs/upgrading/upgrade-to-1.18.x.mdx b/website/content/docs/upgrading/upgrade-to-1.18.x.mdx new file mode 100644 index 0000000000..d111c6c9c9 --- /dev/null +++ b/website/content/docs/upgrading/upgrade-to-1.18.x.mdx @@ -0,0 +1,38 @@ +--- +layout: docs +page_title: Upgrade to Vault 1.18.x - Guides +description: |- + Deprecations, important or breaking changes, and remediation recommendations + for anyone upgrading to 1.18.x from Vault 1.17.x. +--- + +# Overview + +The Vault 1.18.x upgrade guide contains information on deprecations, important +or breaking changes, and remediation recommendations for anyone upgrading from +Vault 1.17. **Please read carefully**. + +## Important changes + +### Activity Log Changes + +The field `default_report_months` can no longer be configured or read. Any previously set values +will be ignored by the system. + + +Attempts to modify `default_report_months` through the +[/sys/internal/counters/config](/vault/api-docs/system/internal-counters#update-the-client-count-configuration) +endpoint, will result in the following warning from Vault: + + + +```shell-session + +WARNING! The following warnings were returned from Vault: + + * default_report_months is deprecated: defaulting to billing start time + + +``` + + diff --git a/website/data/docs-nav-data.json b/website/data/docs-nav-data.json index 340e86a498..9282b5e976 100644 --- a/website/data/docs-nav-data.json +++ b/website/data/docs-nav-data.json @@ -2325,6 +2325,10 @@ "title": "Upgrade to Raft WAL", "path": "upgrading/raft-wal" }, + { + "title": "Upgrade to 1.18.x", + "path": "upgrading/upgrade-to-1.18.x" + }, { "title": "Upgrade to 1.17.x", "path": "upgrading/upgrade-to-1.17.x"