Skip to content

Commit

Permalink
[SIEM] Use ECS categorisation for Authentication widgets (#60734) (#6…
Browse files Browse the repository at this point in the history
…0890)

* Update the Authentication histogram to use categorization fields

* linting

* Use categorization fields for the Authentications table

* Use event.outcome for authentications KPIs

* Adjust mock to fix unit test

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
tsg and elasticmachine authored Mar 24, 2020
1 parent 4f18236 commit a524c00
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ const AuthenticationTableManage = manageQuery(AuthenticationTable);
const ID = 'authenticationsOverTimeQuery';
const authStackByOptions: MatrixHistogramOption[] = [
{
text: 'event.type',
value: 'event.type',
text: 'event.outcome',
value: 'event.outcome',
},
];
const DEFAULT_STACK_BY = 'event.type';
const DEFAULT_STACK_BY = 'event.outcome';

enum AuthMatrixDataGroup {
authSuccess = 'authentication_success',
authFailure = 'authentication_failure',
authSuccess = 'success',
authFailure = 'failure',
}

export const authMatrixDataMappingFields: MatrixHistogramMappingTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const buildQuery = ({
failures: {
filter: {
term: {
'event.type': 'authentication_failure',
'event.outcome': 'failure',
},
},
aggs: {
Expand All @@ -86,7 +86,7 @@ export const buildQuery = ({
successes: {
filter: {
term: {
'event.type': 'authentication_success',
'event.outcome': 'success',
},
},
aggs: {
Expand Down
8 changes: 4 additions & 4 deletions x-pack/legacy/plugins/siem/server/lib/kpi_hosts/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,15 @@ export const mockKpiHostDetailsUniqueIpsQuery = [
];

const mockAuthAggs = {
authentication_success: { filter: { term: { 'event.type': 'authentication_success' } } },
authentication_success: { filter: { term: { 'event.outcome': 'success' } } },
authentication_success_histogram: {
auto_date_histogram: { field: '@timestamp', buckets: '6' },
aggs: { count: { filter: { term: { 'event.type': 'authentication_success' } } } },
aggs: { count: { filter: { term: { 'event.outcome': 'success' } } } },
},
authentication_failure: { filter: { term: { 'event.type': 'authentication_failure' } } },
authentication_failure: { filter: { term: { 'event.outcome': 'failure' } } },
authentication_failure_histogram: {
auto_date_histogram: { field: '@timestamp', buckets: '6' },
aggs: { count: { filter: { term: { 'event.type': 'authentication_failure' } } } },
aggs: { count: { filter: { term: { 'event.outcome': 'failure' } } } },
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const buildAuthQuery = ({
authentication_success: {
filter: {
term: {
'event.type': 'authentication_success',
'event.outcome': 'success',
},
},
},
Expand All @@ -62,7 +62,7 @@ export const buildAuthQuery = ({
count: {
filter: {
term: {
'event.type': 'authentication_success',
'event.outcome': 'success',
},
},
},
Expand All @@ -71,7 +71,7 @@ export const buildAuthQuery = ({
authentication_failure: {
filter: {
term: {
'event.type': 'authentication_failure',
'event.outcome': 'failure',
},
},
},
Expand All @@ -84,7 +84,7 @@ export const buildAuthQuery = ({
count: {
filter: {
term: {
'event.type': 'authentication_failure',
'event.outcome': 'failure',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,21 @@ export const buildAuthenticationsOverTimeQuery = ({
sourceConfiguration: {
fields: { timestamp },
},
stackByField = 'event.type',
stackByField = 'event.outcome',
}: MatrixHistogramRequestOptions) => {
const filter = [
...createQueryFilterClauses(filterQuery),
{
bool: {
must: [
{
term: {
'event.category': 'authentication',
},
},
],
},
},
{
range: {
[timestamp]: {
Expand Down Expand Up @@ -45,7 +56,7 @@ export const buildAuthenticationsOverTimeQuery = ({
eventActionGroup: {
terms: {
field: stackByField,
include: ['authentication_success', 'authentication_failure'],
include: ['success', 'failure'],
order: {
_count: 'desc',
},
Expand Down

0 comments on commit a524c00

Please sign in to comment.