[8.16] [SecuritySolution] Fix entities list initial sorting (#197465) (#198114)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[SecuritySolution] Fix entities list initial sorting
(#197465)](https://github.com/elastic/kibana/pull/197465)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Pablo
Machado","email":"pablo.nevesmachado@elastic.co"},"sourceCommit":{"committedDate":"2024-10-24T14:04:13Z","message":"[SecuritySolution]
Fix entities list initial sorting (#197465)\n\n## Summary\r\n\r\nThe
entity list initial sorting wasn't working because it referenced
an\r\nold
field.","sha":"7a8d813a9ccb3dcb3aa8c7524f2e07f8d0ce5781","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:
SecuritySolution","Theme: entity_analytics","Feature:Entity
Analytics","Team:Entity
Analytics","v8.16.0","backport:version","v8.17.0"],"number":197465,"url":"https://github.com/elastic/kibana/pull/197465","mergeCommit":{"message":"[SecuritySolution]
Fix entities list initial sorting (#197465)\n\n## Summary\r\n\r\nThe
entity list initial sorting wasn't working because it referenced
an\r\nold
field.","sha":"7a8d813a9ccb3dcb3aa8c7524f2e07f8d0ce5781"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197465","number":197465,"mergeCommit":{"message":"[SecuritySolution]
Fix entities list initial sorting (#197465)\n\n## Summary\r\n\r\nThe
entity list initial sorting wasn't working because it referenced
an\r\nold
field.","sha":"7a8d813a9ccb3dcb3aa8c7524f2e07f8d0ce5781"}},{"branch":"8.16","label":"v8.16.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","labelRegex":"^v8.17.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/197657","number":197657,"state":"MERGED","mergeCommit":{"sha":"ccc7398809ce4a39c5f7955700df5e04f0d1b191","message":"[8.x]
[SecuritySolution] Fix entities list initial sorting (#197465)
(#197657)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.x`:\n- [[SecuritySolution] Fix entities list initial
sorting\n(#197465)](https://github.com/elastic/kibana/pull/197465)\n\n<!---
Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Pablo\nMachado\",\"email\":\"pablo.nevesmachado@elastic.co\"},\"sourceCommit\":{\"committedDate\":\"2024-10-24T14:04:13Z\",\"message\":\"[SecuritySolution]\nFix
entities list initial sorting (#197465)\\n\\n##
Summary\\r\\n\\r\\nThe\nentity list initial sorting wasn't working
because it
referenced\nan\\r\\nold\nfield.\",\"sha\":\"7a8d813a9ccb3dcb3aa8c7524f2e07f8d0ce5781\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.17.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"v9.0.0\",\"Team:\nSecuritySolution\",\"Theme:
entity_analytics\",\"Feature:Entity\nAnalytics\",\"Team:Entity\nAnalytics\",\"v8.16.0\",\"backport:version\",\"v8.17.0\"],\"title\":\"[SecuritySolution]\nFix
entities list
initial\nsorting\",\"number\":197465,\"url\":\"https://github.com/elastic/kibana/pull/197465\",\"mergeCommit\":{\"message\":\"[SecuritySolution]\nFix
entities list initial sorting (#197465)\\n\\n##
Summary\\r\\n\\r\\nThe\nentity list initial sorting wasn't working
because it
referenced\nan\\r\\nold\nfield.\",\"sha\":\"7a8d813a9ccb3dcb3aa8c7524f2e07f8d0ce5781\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[\"8.16\",\"8.x\"],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/197465\",\"number\":197465,\"mergeCommit\":{\"message\":\"[SecuritySolution]\nFix
entities list initial sorting (#197465)\\n\\n##
Summary\\r\\n\\r\\nThe\nentity list initial sorting wasn't working
because it
referenced\nan\\r\\nold\nfield.\",\"sha\":\"7a8d813a9ccb3dcb3aa8c7524f2e07f8d0ce5781\"}},{\"branch\":\"8.16\",\"label\":\"v8.16.0\",\"branchLabelMappingKey\":\"^v(\\\\d+).(\\\\d+).\\\\d+$\",\"isSourceBranch\":false,\"state\":\"NOT_CREATED\"},{\"branch\":\"8.x\",\"label\":\"v8.17.0\",\"branchLabelMappingKey\":\"^v8.17.0$\",\"isSourceBranch\":false,\"state\":\"NOT_CREATED\"}]}]\nBACKPORT-->\n\nCo-authored-by:
Pablo Machado <pablo.nevesmachado@elastic.co>"}}]}] BACKPORT-->
This commit is contained in:
Pablo Machado 2024-10-29 12:30:50 +01:00 committed by GitHub
parent 667e7711b6
commit 9d57fda3fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 103 additions and 92 deletions

View file

@ -34,7 +34,7 @@ export const EntitiesList: React.FC = () => {
const [limit, setLimit] = useState(10);
const { toggleStatus } = useQueryToggle(ENTITIES_LIST_TABLE_ID);
const [sorting, setSorting] = useState({
field: 'entity.lastSeenTimestamp',
field: '@timestamp',
direction: Direction.desc,
});

View file

@ -53,7 +53,7 @@ export const listEntitiesRoute = (router: EntityAnalyticsRoutesDeps['router'], l
const {
page = 1,
per_page: perPage = 10,
sort_field: sortField = 'entity.lastSeenTimestamp',
sort_field: sortField = '@timestamp',
sort_order: sortOrder = 'desc',
entities_types: entityTypes,
filterQuery,

View file

@ -4,6 +4,7 @@
"id": "a4cf452c1e0375c3d4412cb550ad1783358468a3b3b777da4829d72c7d6fb74f",
"index": ".entities.v1.latest.security_user_default",
"source": {
"@timestamp": "2024-09-11T11:24:15.588Z",
"event": {
"ingested": "2024-09-11T11:26:49.706875Z"
},
@ -17,17 +18,10 @@
"hash": []
},
"entity": {
"lastSeenTimestamp": "2024-09-11T11:24:15.588Z",
"schemaVersion": "v1",
"definitionVersion": "1.0.0",
"displayName": "hinamatsumoto",
"identityFields": [
"user.name"
],
"id": "LBQAgKHGmpup0Kg9nlKmeQ==",
"type": "node",
"firstSeenTimestamp": "2024-09-11T10:46:00.000Z",
"definitionId": "security_user_default"
"name": "hinamatsumoto",
"id": "hinamatsumoto",
"type": "user",
"source": ".ds-logs-endpoint.alerts-default-2024.10.23-000001"
}
}
}
@ -39,6 +33,7 @@
"id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb71f",
"index": ".entities.v1.latest.security_host_default",
"source": {
"@timestamp": "2024-09-11T11:24:15.591Z",
"event": {
"ingested": "2024-09-11T11:26:49.641707Z"
},
@ -68,17 +63,10 @@
]
},
"entity": {
"lastSeenTimestamp": "2024-09-11T11:24:15.591Z",
"schemaVersion": "v1",
"definitionVersion": "1.0.0",
"displayName": "ali-ubuntu-server",
"identityFields": [
"host.name"
],
"id": "ZXKm6GEcUJY6NHkMgPPmGQ==",
"type": "node",
"firstSeenTimestamp": "2024-09-11T10:46:00.000Z",
"definitionId": "security_host_default"
"name": "ali-ubuntu-server",
"id": "ali-ubuntu-server",
"type": "host",
"source": ".ds-logs-endpoint.events.process-default-2024.10.23-000001"
}
}
}

View file

@ -33,6 +33,16 @@
}
],
"properties": {
"@timestamp": {
"type": "date"
},
"asset": {
"properties": {
"criticality": {
"type": "keyword"
}
}
},
"entity": {
"properties": {
"definitionId": {
@ -65,10 +75,21 @@
"lastSeenTimestamp": {
"type": "date"
},
"name": {
"type": "text",
"fields": {
"text": {
"type": "keyword"
}
}
},
"schemaVersion": {
"type": "keyword",
"ignore_above": 1024
},
"source": {
"type": "keyword"
},
"type": {
"type": "keyword",
"ignore_above": 1024
@ -85,58 +106,41 @@
"host": {
"properties": {
"architecture": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
}
}
"type": "keyword"
},
"domain": {
"type": "keyword"
},
"hostname": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
}
}
"type": "keyword"
},
"id": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
}
}
"type": "keyword"
},
"ip": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
}
}
"type": "ip"
},
"mac": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
"type": "keyword"
},
"name": {
"type": "keyword"
},
"risk": {
"properties": {
"calculated_level": {
"type": "keyword"
},
"calculated_score": {
"type": "float"
},
"calculated_score_norm": {
"type": "float"
}
}
},
"name": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
}
}
"type": {
"type": "keyword"
}
}
},
@ -194,6 +198,16 @@
}
],
"properties": {
"@timestamp": {
"type": "date"
},
"asset": {
"properties": {
"criticality": {
"type": "keyword"
}
}
},
"entity": {
"properties": {
"definitionId": {
@ -226,10 +240,21 @@
"lastSeenTimestamp": {
"type": "date"
},
"name": {
"type": "text",
"fields": {
"text": {
"type": "keyword"
}
}
},
"schemaVersion": {
"type": "keyword",
"ignore_above": 1024
},
"source": {
"type": "keyword"
},
"type": {
"type": "keyword",
"ignore_above": 1024
@ -253,40 +278,38 @@
"user": {
"properties": {
"domain": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
}
}
"type": "keyword"
},
"email": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
}
}
"type": "keyword"
},
"full_name": {
"type": "keyword"
},
"hash": {
"type": "keyword"
},
"id": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
"type": "keyword"
},
"name": {
"type": "keyword"
},
"risk": {
"properties": {
"calculated_level": {
"type": "keyword"
},
"calculated_score": {
"type": "float"
},
"calculated_score_norm": {
"type": "float"
}
}
},
"name": {
"type": "keyword",
"ignore_above": 1024,
"fields": {
"text": {
"type": "text"
}
}
"roles": {
"type": "keyword"
}
}
}