Skip to content

Extend session index fields mapping with a session creation timestamp.#145997

Merged
azasypkin merged 2 commits intoelastic:mainfrom
azasypkin:issue-145097-extend-session
Nov 24, 2022
Merged

Extend session index fields mapping with a session creation timestamp.#145997
azasypkin merged 2 commits intoelastic:mainfrom
azasypkin:issue-145097-extend-session

Conversation

@azasypkin
Copy link
Contributor

@azasypkin azasypkin commented Nov 22, 2022

Summary

To support initial phase of the current sessions limiting functionality described in #18162 (comment) we need to know when session was created to pick the oldest one to displace.

In this PR I introduced:

  • A new createdAt field in the Kibana session index mappings
  • A logic to update mappings if the session index exists, but the mappings are outdated
  • A logic to set createdAt field when Kibana creates a new session

Fixes: #145097

@azasypkin azasypkin added Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// release_note:skip Skip the PR/issue when compiling release notes skip-ci Feature:Security/Session Management Platform Security - Session Management v8.7.0 ci:no-auto-commit Disable auto-committing changes on CI and removed skip-ci labels Nov 22, 2022
@azasypkin azasypkin force-pushed the issue-145097-extend-session branch 3 times, most recently from e6da764 to 522d50e Compare November 23, 2022 15:45
@azasypkin azasypkin marked this pull request as ready for review November 23, 2022 16:44
@azasypkin azasypkin requested a review from a team as a code owner November 23, 2022 16:44
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

Copy link
Contributor

@watson watson left a comment

Choose a reason for hiding this comment

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

Looks good 👍

The JSDoc comment for the Session.prototype.update function says:

Creates or updates session [...]

The "Creates" part got me a little confused during the review, but I guess it's wrong and that it should technically just say Updates session [...].

@azasypkin
Copy link
Contributor Author

The "Creates" part got me a little confused during the review, but I guess it's wrong and that it should technically just say Updates session [...].

Good catch, JSDoc is wrong, I'll fix it.

@azasypkin azasypkin force-pushed the issue-145097-extend-session branch from 80e1cd6 to 9ff6838 Compare November 24, 2022 15:21
@kibana-ci
Copy link

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 109 115 +6
securitySolution 443 449 +6
total +20

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 68 74 +6
osquery 110 117 +7
securitySolution 520 526 +6
total +21

History

  • 💚 Build #90678 succeeded b49e1825dedc80654f0e038b83cf99ecba8c6b5e
  • 💚 Build #90377 succeeded 522d50e2924153097591cb5269e4417a062b2814
  • 💛 Build #90192 was flaky e6da764d79594ce33291d6955499e24b6b46f2d8
  • 💔 Build #90088 failed 7900c1214695e823253e673bae7b08c48aedae27

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@azasypkin azasypkin merged commit 8f790d7 into elastic:main Nov 24, 2022
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Nov 24, 2022
@azasypkin azasypkin deleted the issue-145097-extend-session branch November 24, 2022 16:21
jloleysens added a commit to jloleysens/kibana that referenced this pull request Nov 28, 2022
* main: (30 commits)
  [Cloud Posture] test latest findings table sort (elastic#144668)
  [api-docs] 2022-11-28 Daily api_docs build (elastic#146359)
  [api-docs] 2022-11-27 Daily api_docs build (elastic#146353)
  [api-docs] 2022-11-26 Daily api_docs build (elastic#146350)
  [DataViews] Fix form validation UX when the same data view name already exists (elastic#146126)
  [Discover] Prevent agg based visualizations of Discover saved objects with adhoc data views (elastic#145583)
  [Health Gateway] Update response aggregation (elastic#145761)
  [api-docs] 2022-11-25 Daily api_docs build (elastic#146341)
  [Metric threshold rule] Adds new context variable for group by keys (elastic#145654)
  [Controls] [Portable Dashboards] Add control group renderer example plugin (elastic#146189)
  Refactor Observability Overview Page (elastic#146182)
  Send complete test data to xMatters, so it can create an alert (elastic#145431)
  [Dashboard] [Controls] Allow options list suggestions to be sorted (elastic#144867)
  Add open API specification for list connector types (elastic#145951)
  skip flaky suite (elastic#146086)
  [ML] Removing duplicate tooltip text (elastic#146308)
  Refactor Rules Page (elastic#146193)
  [DOCS] Alert limit for cases (elastic#145950)
  Extend session index fields mapping with a session creation timestamp. (elastic#145997)
  [Files] Move <Image /> component to `@kbn/shared-ux` package (elastic#145995)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:no-auto-commit Disable auto-committing changes on CI Feature:Security/Session Management Platform Security - Session Management release_note:skip Skip the PR/issue when compiling release notes Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// v8.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend session index fields mapping with a session creation timestamp

5 participants