Skip to content

[Security Solution] Fix time duration normalization at rule schedule for day units#224083

Merged
maximpn merged 2 commits intoelastic:mainfrom
maximpn:fix-rule-lookback-time-inconsistency
Jun 20, 2025
Merged

[Security Solution] Fix time duration normalization at rule schedule for day units#224083
maximpn merged 2 commits intoelastic:mainfrom
maximpn:fix-rule-lookback-time-inconsistency

Conversation

@maximpn
Copy link
Copy Markdown
Contributor

@maximpn maximpn commented Jun 16, 2025

Fixes: #223446

Summary

This PR fixes an issue when time duration normalized to day(s) is shown as 0 seconds. The fix is performed by allowing using days time unit at rule schedule.

Details

The issue happens when rule schedule's look-back gets normalized to day(s). The reason is that look-backs input doesn't support Days time unit. It leads to inability to parse the value and displaying the default value which is 0 seconds.

Rule schedule is shown to the users as rule interval and look-back while rule's SO saves the schedule by using three fields interval, from and to. Where look-back represents a logical value calculated as lookback = to - from - interval. Taking that into account it's becomes harder to maintain the original time duration unit value during prebuilt rules upgrade workflow (See #204317 for more details).

The easiest way to fix this issue is to allow Days time unit in rule schedule inputs. On top of that 24 hours are always 1 day making hours the largest simply convertible time unit. The PR allows hours in rule schedule.

Before:

Screen.Recording.2025-06-16.at.19.55.10.mov

After:

Screen.Recording.2025-06-16.at.19.53.10.mov

@maximpn maximpn self-assigned this Jun 16, 2025
@maximpn maximpn added release_note:fix Feature:Detection Rules Security Solution rules and Detection Engine Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Jun 16, 2025
@maximpn maximpn marked this pull request as ready for review June 16, 2025 14:44
@maximpn maximpn requested review from a team as code owners June 16, 2025 14:44
@maximpn maximpn requested a review from denar50 June 16, 2025 14:44
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@maximpn maximpn requested a review from jkelas June 16, 2025 14:44
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@maximpn maximpn changed the title [Security Solution] Fix time duration normalization to days at rule schedule [Security Solution] Fix time duration normalization at rule schedule for day units Jun 16, 2025
Copy link
Copy Markdown
Contributor

@jkelas jkelas left a comment

Choose a reason for hiding this comment

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

I reviewed the changes and confirm they are OK.

I verified that the functionality is improved vs main branch. Below are the screenshots.

I am approving the PR.

image image image

Copy link
Copy Markdown
Contributor

@denar50 denar50 left a comment

Choose a reason for hiding this comment

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

LGTM! I have tested this locally and confirmed that the bug is indeed fixed.

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 9.4MB 9.4MB +4.0B

History

cc @maximpn

@maximpn maximpn merged commit a013929 into elastic:main Jun 20, 2025
10 checks passed
@maximpn maximpn deleted the fix-rule-lookback-time-inconsistency branch June 20, 2025 14:42
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15781478686

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 20, 2025
…for day units (elastic#224083)

**Addresses:** elastic#223446

## Summary

This PR fixes an issue when time duration normalized to day(s) is shown as 0 seconds. The fix is performed by allowing using days time unit at rule schedule.

## Details

The issue happens when rule schedule's look-back gets normalized to day(s). The reason is that look-backs input doesn't support Days time unit. It leads to inability to parse the value and displaying the default value which is 0 seconds.

Rule schedule is shown to the users as rule `interval` and `look-back` while rule's SO saves the schedule by using three fields `interval`, `from` and `to`. Where `look-back` represents a logical value calculated as `lookback` = `to` - `from` - `interval`. Taking that into account it's becomes harder to maintain the original time duration unit value during prebuilt rules upgrade workflow (See elastic#204317 for more details).

The easiest way to fix this issue is to allow Days time unit in rule schedule inputs. On top of that 24 hours are always 1 day making hours the largest simply convertible time unit. The PR allows hours in rule schedule.

**Before:**

https://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605

**After:**

https://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a
(cherry picked from commit a013929)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 20, 2025
…hedule for day units (#224083) (#224716)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Security Solution] Fix time duration normalization at rule schedule
for day units (#224083)](#224083)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2025-06-20T14:42:42Z","message":"[Security
Solution] Fix time duration normalization at rule schedule for day units
(#224083)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/223446\n\n## Summary\n\nThis PR
fixes an issue when time duration normalized to day(s) is shown as 0
seconds. The fix is performed by allowing using days time unit at rule
schedule.\n\n## Details\n\nThe issue happens when rule schedule's
look-back gets normalized to day(s). The reason is that look-backs input
doesn't support Days time unit. It leads to inability to parse the value
and displaying the default value which is 0 seconds.\n\nRule schedule is
shown to the users as rule `interval` and `look-back` while rule's SO
saves the schedule by using three fields `interval`, `from` and `to`.
Where `look-back` represents a logical value calculated as `lookback` =
`to` - `from` - `interval`. Taking that into account it's becomes harder
to maintain the original time duration unit value during prebuilt rules
upgrade workflow (See #204317 for
more details).\n\nThe easiest way to fix this issue is to allow Days
time unit in rule schedule inputs. On top of that 24 hours are always 1
day making hours the largest simply convertible time unit. The PR allows
hours in rule
schedule.\n\n**Before:**\n\nhttps://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605\n\n**After:**\n\nhttps://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a","sha":"a013929fda4dbae08b52d8258c37cb4c144a83f5","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Detection
Rules","Team:Detections and Resp","Team:
SecuritySolution","Team:Detection Rule
Management","backport:version","v9.1.0","v8.19.0"],"title":"[Security
Solution] Fix time duration normalization at rule schedule for day
units","number":224083,"url":"https://github.com/elastic/kibana/pull/224083","mergeCommit":{"message":"[Security
Solution] Fix time duration normalization at rule schedule for day units
(#224083)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/223446\n\n## Summary\n\nThis PR
fixes an issue when time duration normalized to day(s) is shown as 0
seconds. The fix is performed by allowing using days time unit at rule
schedule.\n\n## Details\n\nThe issue happens when rule schedule's
look-back gets normalized to day(s). The reason is that look-backs input
doesn't support Days time unit. It leads to inability to parse the value
and displaying the default value which is 0 seconds.\n\nRule schedule is
shown to the users as rule `interval` and `look-back` while rule's SO
saves the schedule by using three fields `interval`, `from` and `to`.
Where `look-back` represents a logical value calculated as `lookback` =
`to` - `from` - `interval`. Taking that into account it's becomes harder
to maintain the original time duration unit value during prebuilt rules
upgrade workflow (See #204317 for
more details).\n\nThe easiest way to fix this issue is to allow Days
time unit in rule schedule inputs. On top of that 24 hours are always 1
day making hours the largest simply convertible time unit. The PR allows
hours in rule
schedule.\n\n**Before:**\n\nhttps://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605\n\n**After:**\n\nhttps://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a","sha":"a013929fda4dbae08b52d8258c37cb4c144a83f5"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224083","number":224083,"mergeCommit":{"message":"[Security
Solution] Fix time duration normalization at rule schedule for day units
(#224083)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/223446\n\n## Summary\n\nThis PR
fixes an issue when time duration normalized to day(s) is shown as 0
seconds. The fix is performed by allowing using days time unit at rule
schedule.\n\n## Details\n\nThe issue happens when rule schedule's
look-back gets normalized to day(s). The reason is that look-backs input
doesn't support Days time unit. It leads to inability to parse the value
and displaying the default value which is 0 seconds.\n\nRule schedule is
shown to the users as rule `interval` and `look-back` while rule's SO
saves the schedule by using three fields `interval`, `from` and `to`.
Where `look-back` represents a logical value calculated as `lookback` =
`to` - `from` - `interval`. Taking that into account it's becomes harder
to maintain the original time duration unit value during prebuilt rules
upgrade workflow (See #204317 for
more details).\n\nThe easiest way to fix this issue is to allow Days
time unit in rule schedule inputs. On top of that 24 hours are always 1
day making hours the largest simply convertible time unit. The PR allows
hours in rule
schedule.\n\n**Before:**\n\nhttps://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605\n\n**After:**\n\nhttps://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a","sha":"a013929fda4dbae08b52d8258c37cb4c144a83f5"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
@banderror banderror added Feature:Rule Creation Security Solution Detection Rule Creation workflow Feature:Rule Edit Security Solution Detection Rule Editing workflow and removed Feature:Detection Rules Security Solution rules and Detection Engine labels Jun 24, 2025
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request Jun 25, 2025
…for day units (elastic#224083)

**Addresses:** elastic#223446

## Summary

This PR fixes an issue when time duration normalized to day(s) is shown as 0 seconds. The fix is performed by allowing using days time unit at rule schedule.

## Details

The issue happens when rule schedule's look-back gets normalized to day(s). The reason is that look-backs input doesn't support Days time unit. It leads to inability to parse the value and displaying the default value which is 0 seconds.

Rule schedule is shown to the users as rule `interval` and `look-back` while rule's SO saves the schedule by using three fields `interval`, `from` and `to`. Where `look-back` represents a logical value calculated as `lookback` = `to` - `from` - `interval`. Taking that into account it's becomes harder to maintain the original time duration unit value during prebuilt rules upgrade workflow (See elastic#204317 for more details).

The easiest way to fix this issue is to allow Days time unit in rule schedule inputs. On top of that 24 hours are always 1 day making hours the largest simply convertible time unit. The PR allows hours in rule schedule.

**Before:**

https://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605

**After:**

https://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a
@maximpn
Copy link
Copy Markdown
Contributor Author

maximpn commented Jun 26, 2025

💚 All backports created successfully

Status Branch Result
8.18

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

maximpn added a commit to maximpn/kibana that referenced this pull request Jun 26, 2025
…for day units (elastic#224083)

**Addresses:** elastic#223446

## Summary

This PR fixes an issue when time duration normalized to day(s) is shown as 0 seconds. The fix is performed by allowing using days time unit at rule schedule.

## Details

The issue happens when rule schedule's look-back gets normalized to day(s). The reason is that look-backs input doesn't support Days time unit. It leads to inability to parse the value and displaying the default value which is 0 seconds.

Rule schedule is shown to the users as rule `interval` and `look-back` while rule's SO saves the schedule by using three fields `interval`, `from` and `to`. Where `look-back` represents a logical value calculated as `lookback` = `to` - `from` - `interval`. Taking that into account it's becomes harder to maintain the original time duration unit value during prebuilt rules upgrade workflow (See elastic#204317 for more details).

The easiest way to fix this issue is to allow Days time unit in rule schedule inputs. On top of that 24 hours are always 1 day making hours the largest simply convertible time unit. The PR allows hours in rule schedule.

**Before:**

https://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605

**After:**

https://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a
(cherry picked from commit a013929)
maximpn added a commit to maximpn/kibana that referenced this pull request Jul 3, 2025
…for day units (elastic#224083)

**Addresses:** elastic#223446

## Summary

This PR fixes an issue when time duration normalized to day(s) is shown as 0 seconds. The fix is performed by allowing using days time unit at rule schedule.

## Details

The issue happens when rule schedule's look-back gets normalized to day(s). The reason is that look-backs input doesn't support Days time unit. It leads to inability to parse the value and displaying the default value which is 0 seconds.

Rule schedule is shown to the users as rule `interval` and `look-back` while rule's SO saves the schedule by using three fields `interval`, `from` and `to`. Where `look-back` represents a logical value calculated as `lookback` = `to` - `from` - `interval`. Taking that into account it's becomes harder to maintain the original time duration unit value during prebuilt rules upgrade workflow (See elastic#204317 for more details).

The easiest way to fix this issue is to allow Days time unit in rule schedule inputs. On top of that 24 hours are always 1 day making hours the largest simply convertible time unit. The PR allows hours in rule schedule.

**Before:**

https://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605

**After:**

https://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a
(cherry picked from commit a013929)
@maximpn
Copy link
Copy Markdown
Contributor Author

maximpn commented Jul 3, 2025

💚 All backports created successfully

Status Branch Result
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

maximpn added a commit that referenced this pull request Jul 3, 2025
…hedule for day units (#224083) (#225424)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Security Solution] Fix time duration normalization at rule schedule
for day units (#224083)](#224083)

<!--- Backport version: 10.0.1 -->

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

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2025-06-20T14:42:42Z","message":"[Security
Solution] Fix time duration normalization at rule schedule for day units
(#224083)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/223446\n\n## Summary\n\nThis PR
fixes an issue when time duration normalized to day(s) is shown as 0
seconds. The fix is performed by allowing using days time unit at rule
schedule.\n\n## Details\n\nThe issue happens when rule schedule's
look-back gets normalized to day(s). The reason is that look-backs input
doesn't support Days time unit. It leads to inability to parse the value
and displaying the default value which is 0 seconds.\n\nRule schedule is
shown to the users as rule `interval` and `look-back` while rule's SO
saves the schedule by using three fields `interval`, `from` and `to`.
Where `look-back` represents a logical value calculated as `lookback` =
`to` - `from` - `interval`. Taking that into account it's becomes harder
to maintain the original time duration unit value during prebuilt rules
upgrade workflow (See #204317 for
more details).\n\nThe easiest way to fix this issue is to allow Days
time unit in rule schedule inputs. On top of that 24 hours are always 1
day making hours the largest simply convertible time unit. The PR allows
hours in rule
schedule.\n\n**Before:**\n\nhttps://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605\n\n**After:**\n\nhttps://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a","sha":"a013929fda4dbae08b52d8258c37cb4c144a83f5","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Rule Creation","Feature:Rule
Edit","backport:version","v9.1.0","v8.19.0"],"title":"[Security
Solution] Fix time duration normalization at rule schedule for day
units","number":224083,"url":"https://github.com/elastic/kibana/pull/224083","mergeCommit":{"message":"[Security
Solution] Fix time duration normalization at rule schedule for day units
(#224083)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/223446\n\n## Summary\n\nThis PR
fixes an issue when time duration normalized to day(s) is shown as 0
seconds. The fix is performed by allowing using days time unit at rule
schedule.\n\n## Details\n\nThe issue happens when rule schedule's
look-back gets normalized to day(s). The reason is that look-backs input
doesn't support Days time unit. It leads to inability to parse the value
and displaying the default value which is 0 seconds.\n\nRule schedule is
shown to the users as rule `interval` and `look-back` while rule's SO
saves the schedule by using three fields `interval`, `from` and `to`.
Where `look-back` represents a logical value calculated as `lookback` =
`to` - `from` - `interval`. Taking that into account it's becomes harder
to maintain the original time duration unit value during prebuilt rules
upgrade workflow (See #204317 for
more details).\n\nThe easiest way to fix this issue is to allow Days
time unit in rule schedule inputs. On top of that 24 hours are always 1
day making hours the largest simply convertible time unit. The PR allows
hours in rule
schedule.\n\n**Before:**\n\nhttps://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605\n\n**After:**\n\nhttps://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a","sha":"a013929fda4dbae08b52d8258c37cb4c144a83f5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224083","number":224083,"mergeCommit":{"message":"[Security
Solution] Fix time duration normalization at rule schedule for day units
(#224083)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/223446\n\n## Summary\n\nThis PR
fixes an issue when time duration normalized to day(s) is shown as 0
seconds. The fix is performed by allowing using days time unit at rule
schedule.\n\n## Details\n\nThe issue happens when rule schedule's
look-back gets normalized to day(s). The reason is that look-backs input
doesn't support Days time unit. It leads to inability to parse the value
and displaying the default value which is 0 seconds.\n\nRule schedule is
shown to the users as rule `interval` and `look-back` while rule's SO
saves the schedule by using three fields `interval`, `from` and `to`.
Where `look-back` represents a logical value calculated as `lookback` =
`to` - `from` - `interval`. Taking that into account it's becomes harder
to maintain the original time duration unit value during prebuilt rules
upgrade workflow (See #204317 for
more details).\n\nThe easiest way to fix this issue is to allow Days
time unit in rule schedule inputs. On top of that 24 hours are always 1
day making hours the largest simply convertible time unit. The PR allows
hours in rule
schedule.\n\n**Before:**\n\nhttps://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605\n\n**After:**\n\nhttps://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a","sha":"a013929fda4dbae08b52d8258c37cb4c144a83f5"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/224716","number":224716,"state":"MERGED","mergeCommit":{"sha":"0163914af918d1ee0181d731224f00e14cadc4db","message":"[8.19]
[Security Solution] Fix time duration normalization at rule schedule for
day units (#224083) (#224716)\n\n# Backport\n\nThis will backport the
following commits from `main` to `8.19`:\n- [[Security Solution] Fix
time duration normalization at rule schedule\nfor day units
(#224083)](https://github.com/elastic/kibana/pull/224083)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Maxim Palenov <maxim.palenov@elastic.co>"}}]}] BACKPORT-->
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.18, 8.19, 9.1

https://github.com/elastic/kibana/actions/runs/16048942548

@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.18, 8.19, 9.1

https://github.com/elastic/kibana/actions/runs/16048947847

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.18 Cherrypick failed because the selected commit (a013929) is empty. It looks like the commit was already backported in #225424
8.19 Cherrypick failed because the selected commit (a013929) is empty. It looks like the commit was already backported in #224716
9.1 Cherrypick failed because the selected commit (a013929) is empty. Did you already backport this commit?

Manual backport

To create the backport manually run:

node scripts/backport --pr 224083

Questions ?

Please refer to the Backport tool documentation

1 similar comment
@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.18 Cherrypick failed because the selected commit (a013929) is empty. It looks like the commit was already backported in #225424
8.19 Cherrypick failed because the selected commit (a013929) is empty. It looks like the commit was already backported in #224716
9.1 Cherrypick failed because the selected commit (a013929) is empty. Did you already backport this commit?

Manual backport

To create the backport manually run:

node scripts/backport --pr 224083

Questions ?

Please refer to the Backport tool documentation

maximpn added a commit that referenced this pull request Jul 3, 2025
…edule for day units (#224083) (#226388)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Security Solution] Fix time duration normalization at rule schedule
for day units (#224083)](#224083)

<!--- Backport version: 10.0.1 -->

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

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2025-06-20T14:42:42Z","message":"[Security
Solution] Fix time duration normalization at rule schedule for day units
(#224083)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/223446\n\n## Summary\n\nThis PR
fixes an issue when time duration normalized to day(s) is shown as 0
seconds. The fix is performed by allowing using days time unit at rule
schedule.\n\n## Details\n\nThe issue happens when rule schedule's
look-back gets normalized to day(s). The reason is that look-backs input
doesn't support Days time unit. It leads to inability to parse the value
and displaying the default value which is 0 seconds.\n\nRule schedule is
shown to the users as rule `interval` and `look-back` while rule's SO
saves the schedule by using three fields `interval`, `from` and `to`.
Where `look-back` represents a logical value calculated as `lookback` =
`to` - `from` - `interval`. Taking that into account it's becomes harder
to maintain the original time duration unit value during prebuilt rules
upgrade workflow (See #204317 for
more details).\n\nThe easiest way to fix this issue is to allow Days
time unit in rule schedule inputs. On top of that 24 hours are always 1
day making hours the largest simply convertible time unit. The PR allows
hours in rule
schedule.\n\n**Before:**\n\nhttps://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605\n\n**After:**\n\nhttps://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a","sha":"a013929fda4dbae08b52d8258c37cb4c144a83f5","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Rule Creation","Feature:Rule
Edit","backport:version","v9.1.0","v8.19.0"],"title":"[Security
Solution] Fix time duration normalization at rule schedule for day
units","number":224083,"url":"https://github.com/elastic/kibana/pull/224083","mergeCommit":{"message":"[Security
Solution] Fix time duration normalization at rule schedule for day units
(#224083)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/223446\n\n## Summary\n\nThis PR
fixes an issue when time duration normalized to day(s) is shown as 0
seconds. The fix is performed by allowing using days time unit at rule
schedule.\n\n## Details\n\nThe issue happens when rule schedule's
look-back gets normalized to day(s). The reason is that look-backs input
doesn't support Days time unit. It leads to inability to parse the value
and displaying the default value which is 0 seconds.\n\nRule schedule is
shown to the users as rule `interval` and `look-back` while rule's SO
saves the schedule by using three fields `interval`, `from` and `to`.
Where `look-back` represents a logical value calculated as `lookback` =
`to` - `from` - `interval`. Taking that into account it's becomes harder
to maintain the original time duration unit value during prebuilt rules
upgrade workflow (See #204317 for
more details).\n\nThe easiest way to fix this issue is to allow Days
time unit in rule schedule inputs. On top of that 24 hours are always 1
day making hours the largest simply convertible time unit. The PR allows
hours in rule
schedule.\n\n**Before:**\n\nhttps://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605\n\n**After:**\n\nhttps://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a","sha":"a013929fda4dbae08b52d8258c37cb4c144a83f5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224083","number":224083,"mergeCommit":{"message":"[Security
Solution] Fix time duration normalization at rule schedule for day units
(#224083)\n\n**Addresses:**
https://github.com/elastic/kibana/issues/223446\n\n## Summary\n\nThis PR
fixes an issue when time duration normalized to day(s) is shown as 0
seconds. The fix is performed by allowing using days time unit at rule
schedule.\n\n## Details\n\nThe issue happens when rule schedule's
look-back gets normalized to day(s). The reason is that look-backs input
doesn't support Days time unit. It leads to inability to parse the value
and displaying the default value which is 0 seconds.\n\nRule schedule is
shown to the users as rule `interval` and `look-back` while rule's SO
saves the schedule by using three fields `interval`, `from` and `to`.
Where `look-back` represents a logical value calculated as `lookback` =
`to` - `from` - `interval`. Taking that into account it's becomes harder
to maintain the original time duration unit value during prebuilt rules
upgrade workflow (See #204317 for
more details).\n\nThe easiest way to fix this issue is to allow Days
time unit in rule schedule inputs. On top of that 24 hours are always 1
day making hours the largest simply convertible time unit. The PR allows
hours in rule
schedule.\n\n**Before:**\n\nhttps://github.com/user-attachments/assets/4f2038f1-4a6a-4a88-b86e-381a5b717605\n\n**After:**\n\nhttps://github.com/user-attachments/assets/74875bf2-9341-425f-a35f-c8b088c1ef6a","sha":"a013929fda4dbae08b52d8258c37cb4c144a83f5"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/224716","number":224716,"state":"MERGED","mergeCommit":{"sha":"0163914af918d1ee0181d731224f00e14cadc4db","message":"[8.19]
[Security Solution] Fix time duration normalization at rule schedule for
day units (#224083) (#224716)\n\n# Backport\n\nThis will backport the
following commits from `main` to `8.19`:\n- [[Security Solution] Fix
time duration normalization at rule schedule\nfor day units
(#224083)](https://github.com/elastic/kibana/pull/224083)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Maxim Palenov
<maxim.palenov@elastic.co>"}},{"url":"https://github.com/elastic/kibana/pull/225424","number":225424,"branch":"8.18","state":"OPEN"}]}]
BACKPORT-->
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.18, 8.19, 9.0, 9.1

https://github.com/elastic/kibana/actions/runs/16050892702

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.18 Cherrypick failed because the selected commit (a013929) is empty. It looks like the commit was already backported in #225424
8.19 Cherrypick failed because the selected commit (a013929) is empty. It looks like the commit was already backported in #224716
9.0 Cherrypick failed because the selected commit (a013929) is empty. It looks like the commit was already backported in #226388
9.1 Cherrypick failed because the selected commit (a013929) is empty. Did you already backport this commit?

Manual backport

To create the backport manually run:

node scripts/backport --pr 224083

Questions ?

Please refer to the Backport tool documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Feature:Rule Creation Security Solution Detection Rule Creation workflow Feature:Rule Edit Security Solution Detection Rule Editing workflow release_note:fix Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.18.4 v8.19.0 v9.0.4 v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security Solution] Time value conversion inconsistency in Detection Rule lookback time field

6 participants