Skip to content

Commit

Permalink
continued cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yctercero committed Sep 14, 2021
1 parent cdf65c2 commit ef26e9c
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 16 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/timelines/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class TimelinesPlugin
defineRoutes(router);

// Register search strategy
// Need to pass in security.audit.asScoped
core.getStartServices().then(([_, depsStart]) => {
const TimelineSearchStrategy = timelineSearchStrategyProvider(
depsStart.data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ export const timelineEventsAll: TimelineFactory<TimelineEventsQueries.all> = {
throw new Error(`No query size above ${DEFAULT_MAX_TABLE_QUERY_SIZE}`);
}
const { fieldRequested, ...queryOptions } = cloneDeep(options);
console.log('HHHHHHHEEEEERE 7');

queryOptions.fields = buildFieldsRequest(fieldRequested, queryOptions.excludeEcsData);
console.log('HHHHHHHEEEEERE 8');

return buildTimelineEventsAllQuery({ ...queryOptions, authFilter });
},
parse: async (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const buildTimelineEventsAllQuery = ({

const filters = [...filterClause, ...getTimerangeFilter(timerange), { match_all: {} }];
const filter = authFilter != null ? [...filters, authFilter] : filters;
console.log('HHHHHHHEEEEERE 10');

const getSortField = (sortFields: TimelineRequestSortField[]) =>
sortFields.map((item) => {
Expand All @@ -62,7 +61,6 @@ export const buildTimelineEventsAllQuery = ({
},
};
});
console.log('HHHHHHHEEEEERE 11');

const dslQuery = {
allowNoIndices: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,18 @@ const timelineAlertsSearchStrategy = <T extends TimelineFactoryQueryTypes>({
},
});

console.log({ HERE: auditLogger });

return from(getAuthFilter()).pipe(
mergeMap(({ filter }) => {
console.log('HHHHHHHEEEEERE 6');

const dsl = queryFactory.buildDsl({ ...requestWithAlertsIndices, authFilter: filter });
console.log('I AM HERE -----------------------------');
return es.search({ ...requestWithAlertsIndices, params: dsl }, options, deps);
}),
map((response) => {
console.log({ RESPONSE: response });
const rawResponse = shimHitsTotal(response.rawResponse, options);

// Do we have to loop over each hit? Yes.
// ecs auditLogger requires that we log each alert independently
if (auditLogger != null) {
rawResponse.hits?.hits?.forEach((hit) => {
console.log({ hittt: JSON.stringify(hit) });
auditLogger.log(
alertAuditEvent({
action: AlertAuditAction.FIND,
Expand All @@ -174,7 +167,6 @@ const timelineAlertsSearchStrategy = <T extends TimelineFactoryQueryTypes>({
}),
mergeMap((esSearchRes) => queryFactory.parse(requestWithAlertsIndices, esSearchRes)),
catchError((err) => {
console.log({ err: JSON.stringify(err), auditLogger });
// check if auth error, if yes, write to ecs logger
if (auditLogger != null && err?.output?.statusCode === 403) {
auditLogger.log(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default ({ getService }: FtrProviderContext) => {
},
});

describe.only('Timeline - Events', () => {
describe('Timeline - Events', () => {
const logFilePath = Path.resolve(__dirname, '../../../common/fixtures/audit/audit.log');
const logFile = new FileWrapper(logFilePath);
const retry = getService('retry');
Expand Down

0 comments on commit ef26e9c

Please sign in to comment.