forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ AutoImport] Introduce automatic log type detection graph (elastic#1…
…90407) ## Summary This PR introduces a new graph in `Auto Import` called - `LogTypeDetection` Currently, only JSON/NDJSON formats are supported to be uploaded for building custom integrations. With this feature the capabilities to upload different log types is allowed. Although parsing of the new log types will be handled separately with a separate [issue.](elastic/security-team#9845) - The logs are initially parsed for JSON/NDJSON types in the UI side. - If it is not JSON/NDJSON format , then a new API `AnalyzeLogs` is triggered. - UI allows any type of logs to be uploaded. - Currently there is a server level content length restriction of `1MB` which needs to be extended. - For any log types other than JSON/NDJSON the handling graphs are not yet implemented , hence a `501 Not implemented` message appears. - The idea is to support `structured` , `csv` , `unstructured` syslog handling graphs. ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Hanna Tamoudi <hanna.tamoudi@elastic.co> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
9d967e0
commit 9f01f73
Showing
33 changed files
with
640 additions
and
79 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
x-pack/plugins/integration_assistant/__jest__/fixtures/log_type_detection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { SamplesFormatName } from '../../common/api/model/common_attributes'; | ||
|
||
export const logFormatDetectionTestState = { | ||
lastExecutedChain: 'testchain', | ||
logSamples: ['{"test1": "test1"}'], | ||
exAnswer: 'testanswer', | ||
packageName: 'testPackage', | ||
dataStreamName: 'testDatastream', | ||
finalized: false, | ||
samplesFormat: { name: SamplesFormatName.Values.json }, | ||
ecsVersion: 'testVersion', | ||
results: { test1: 'test1' }, | ||
}; |
36 changes: 36 additions & 0 deletions
36
x-pack/plugins/integration_assistant/common/api/analyze_logs/analyze_logs_route.schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
openapi: 3.0.3 | ||
info: | ||
title: Auto Import Analyze Logs API endpoint | ||
version: "1" | ||
paths: | ||
/api/integration_assistant/analyzelogs: | ||
post: | ||
summary: Analyzes log samples and processes them. | ||
operationId: AnalyzeLogs | ||
x-codegen-enabled: false | ||
description: Analyzes log samples and processes them | ||
tags: | ||
- Analyze Logs API | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
required: | ||
- logSamples | ||
- connectorId | ||
properties: | ||
logSamples: | ||
$ref: "../model/common_attributes.schema.yaml#/components/schemas/LogSamples" | ||
connectorId: | ||
$ref: "../model/common_attributes.schema.yaml#/components/schemas/Connector" | ||
langSmithOptions: | ||
$ref: "../model/common_attributes.schema.yaml#/components/schemas/LangSmithOptions" | ||
responses: | ||
200: | ||
description: Indicates a successful call. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "../model/response_schemas.schema.yaml#/components/schemas/AnalyzeLogsAPIResponse" |
31 changes: 31 additions & 0 deletions
31
x-pack/plugins/integration_assistant/common/api/analyze_logs/analyze_logs_route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
/* | ||
* NOTICE: Do not edit this file manually. | ||
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. | ||
* | ||
* info: | ||
* title: Auto Import Analyze Logs API endpoint | ||
* version: 1 | ||
*/ | ||
|
||
import { z } from '@kbn/zod'; | ||
|
||
import { LogSamples, Connector, LangSmithOptions } from '../model/common_attributes'; | ||
import { AnalyzeLogsAPIResponse } from '../model/response_schemas'; | ||
|
||
export type AnalyzeLogsRequestBody = z.infer<typeof AnalyzeLogsRequestBody>; | ||
export const AnalyzeLogsRequestBody = z.object({ | ||
logSamples: LogSamples, | ||
connectorId: Connector, | ||
langSmithOptions: LangSmithOptions.optional(), | ||
}); | ||
export type AnalyzeLogsRequestBodyInput = z.input<typeof AnalyzeLogsRequestBody>; | ||
|
||
export type AnalyzeLogsResponse = z.infer<typeof AnalyzeLogsResponse>; | ||
export const AnalyzeLogsResponse = AnalyzeLogsAPIResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.