Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct Log type detection prompt for complex syslogs #196568

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion x-pack/plugins/integration_assistant/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ export enum GenerationErrorCode {

// Size limits
export const FRONTEND_SAMPLE_ROWS = 100;
export const LOG_FORMAT_DETECTION_SAMPLE_ROWS = 5;
export const LOG_FORMAT_DETECTION_SAMPLE_ROWS = 30;
export const CATEGORIZATION_INITIAL_BATCH_SIZE = 60;
export const CATEROGIZATION_REVIEW_BATCH_SIZE = 40;
export const CATEGORIZATION_REVIEW_MAX_CYCLES = 5;
export const CATEGORIZATION_RECURSION_LIMIT = 50;
export const ANALYZE_LOGS_RECURSION_LIMIT = 50;
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Follow these steps to do this:

You ALWAYS follow these guidelines when writing your response:
<guidelines>
- Do not consider a free-form text with characters like \`:\` \`=\` as structured syslogs.
- Only a message body with characters \`:\` or \`=\` as delimeters to key-value pairs is considered "structured".
- If you can not 100% determine the key-value pairs and a delimeter , classify the syslogs as "unstrtuctured".
- Make sure to verify that the "structured" syslogs have key-value pairs in the message body.
- Do not respond with anything except the updated current mapping JSON object enclosed with 3 backticks (\`). See example response below.
</guidelines>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const GROK_MAIN_PROMPT = ChatPromptTemplate.fromMessages([
<guidelines>
- Make sure to map the remaining message part to \'message\' in grok pattern.
- Make sure to add \`{packageName}.{dataStreamName}\` as a prefix to each field in the pattern. Refer to example response.
- Make sure to escape using double-slash (\`\\\\\`)
- Do not respond with anything except the processor as a JSON object enclosed with 3 backticks (\`), see example response above. Use strict JSON response format.
</guidelines>

Expand Down Expand Up @@ -91,6 +92,7 @@ Follow these steps to help improve the grok patterns and apply it step by step:
<guidelines>
- Make sure to map the remaining message part to \'message\' in grok pattern.
- Make sure to add \`{packageName}.{dataStreamName}\` as a prefix to each field in the pattern. Refer to example response.
- Make sure to escape using double-slash (\`\\\\\`)
- Do not respond with anything except the processor as a JSON object enclosed with 3 backticks (\`), see example response above. Use strict JSON response format.
</guidelines>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { buildRouteValidationWithZod } from '../util/route_validation';
import { withAvailability } from './with_availability';
import { isErrorThatHandlesItsOwnResponse, UnsupportedLogFormatError } from '../lib/errors';
import { handleCustomErrors } from './routes_util';
import { GenerationErrorCode } from '../../common/constants';
import { ANALYZE_LOGS_RECURSION_LIMIT, GenerationErrorCode } from '../../common/constants';

export function registerAnalyzeLogsRoutes(
router: IRouter<IntegrationAssistantRouteHandlerContext>
Expand Down Expand Up @@ -77,6 +77,7 @@ export function registerAnalyzeLogsRoutes(
streaming: false,
});
const options = {
recursionLimit: ANALYZE_LOGS_RECURSION_LIMIT,
callbacks: [
new APMTracer({ projectName: langSmithOptions?.projectName ?? 'default' }, logger),
...getLangSmithTracer({ ...langSmithOptions, logger }),
Expand Down