[Fleet] Use a date processor instead of a script and set (#136678)

This commit is contained in:
Nicolas Chaulet 2022-07-29 19:19:15 -04:00 committed by GitHub
parent cac6c20e4b
commit 34ca5e6f38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View file

@ -77,7 +77,7 @@ export const FLEET_COMPONENT_TEMPLATES = [
},
];
export const FLEET_FINAL_PIPELINE_VERSION = 2;
export const FLEET_FINAL_PIPELINE_VERSION = 3;
// If the content is updated you probably need to update the FLEET_FINAL_PIPELINE_VERSION too to allow upgrade of the pipeline
export const FLEET_FINAL_PIPELINE_CONTENT = `---
@ -88,14 +88,14 @@ _meta:
description: >
Final pipeline for processing all incoming Fleet Agent documents.
processors:
- set:
description: Add time when event was ingested.
field: event.ingested
copy_from: _ingest.timestamp
- script:
description: Remove sub-seconds from event.ingested to improve storage efficiency.
- date:
description: Add time when event was ingested (and remove sub-seconds to improve storage efficiency)
tag: truncate-subseconds-event-ingested
source: ctx.event.ingested = ctx.event.ingested.withNano(0).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
field: _ingest.timestamp
target_field: event.ingested
formats:
- ISO8601
output_format: date_time_no_millis
ignore_failure: true
- remove:
description: Remove any pre-existing untrusted values.

View file

@ -101,7 +101,7 @@ export default function (providerContext: FtrProviderContext) {
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxxx');
const pipelineRes = await es.ingest.getPipeline({ id: FINAL_PIPELINE_ID });
expect(pipelineRes).to.have.property(FINAL_PIPELINE_ID);
expect(pipelineRes[FINAL_PIPELINE_ID].version).to.be(2);
expect(pipelineRes[FINAL_PIPELINE_ID].version).to.be(3);
});
it('should correctly setup the final pipeline and apply to fleet managed index template', async () => {