From 9e365ff1e0029d233c671d74ccc47da17d8ed42d Mon Sep 17 00:00:00 2001 From: ls147258 Date: Tue, 5 May 2026 15:16:01 +0800 Subject: [PATCH] fix: use quoted full-text search instead of field-specific SLS query syntax Field-specific SLS syntax (e.g. requestId: "value") requires key-value index configuration which FC3's default logstore doesn't have, causing "key (requestId) is not config as key value config" errors. Switch to quoted full-text search ("value") which works with the default full-text index configuration. Change-Id: If44111b49fc8bcb9ad6663497f18fa40248106ae Co-developed-by: Claude --- __tests__/ut/commands/logs_test.ts | 8 ++++---- publish.yaml | 2 +- src/subCommands/logs/index.ts | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/__tests__/ut/commands/logs_test.ts b/__tests__/ut/commands/logs_test.ts index 2ac59cb6..00397ef1 100644 --- a/__tests__/ut/commands/logs_test.ts +++ b/__tests__/ut/commands/logs_test.ts @@ -565,7 +565,7 @@ describe('Logs', () => { ); expect(result).toBe( - '__topic__:"FCLogs:test-function" and baseQuery and searchTerm and qualifier: "LATEST" and instanceID: "inst-456" and requestId: "req-123"', + '__topic__:"FCLogs:test-function" and baseQuery and searchTerm and "LATEST" and "inst-456" and "req-123"', ); }); @@ -592,7 +592,7 @@ describe('Logs', () => { ); expect(result).toBe( - '(__topic__:"FCLogs:test-function" or __topic__:"FCInstanceEvents:/test-function") and instanceID: "inst-456"', + '(__topic__:"FCLogs:test-function" or __topic__:"FCInstanceEvents:/test-function") and "inst-456"', ); }); @@ -609,7 +609,7 @@ describe('Logs', () => { expect(result).toBe('__topic__:"FCLogs:test-function"'); }); - it('should use field-specific syntax for qualifier', () => { + it('should use quoted full-text search for qualifier', () => { const result = (logs as any).getSlsQuery( null, null, @@ -619,7 +619,7 @@ describe('Logs', () => { '__topic__:"FCLogs:test-function"', ); - expect(result).toBe('__topic__:"FCLogs:test-function" and qualifier: "LATEST"'); + expect(result).toBe('__topic__:"FCLogs:test-function" and "LATEST"'); }); }); diff --git a/publish.yaml b/publish.yaml index d28ee0f4..79f79f37 100644 --- a/publish.yaml +++ b/publish.yaml @@ -3,7 +3,7 @@ Type: Component Name: fc3 Provider: - 阿里云 -Version: 0.1.19 +Version: 0.1.20 Description: 阿里云函数计算全生命周期管理 HomePage: https://github.com/devsapp/fc3 Organization: 阿里云函数计算(FC) diff --git a/src/subCommands/logs/index.ts b/src/subCommands/logs/index.ts index ecd1944f..ec73bb89 100644 --- a/src/subCommands/logs/index.ts +++ b/src/subCommands/logs/index.ts @@ -297,7 +297,7 @@ export default class Logs { // } if (match) { - l = replaceAll(l, match, `\x1B[43m${match}\x1B[0m`); + l = replaceAll(l, match, `\x1B[7m${match}\x1B[0m`); } console.log(l); @@ -477,17 +477,17 @@ export default class Logs { } if (!_.isNil(qualifier)) { - q = hasValue ? `${q} and qualifier: "${qualifier}"` : `qualifier: "${qualifier}"`; + q = hasValue ? `${q} and "${qualifier}"` : `"${qualifier}"`; hasValue = true; } if (!_.isNil(instanceId)) { - q = hasValue ? `${q} and instanceID: "${instanceId}"` : `instanceID: "${instanceId}"`; + q = hasValue ? `${q} and "${instanceId}"` : `"${instanceId}"`; hasValue = true; } if (!_.isNil(requestId)) { - q = hasValue ? `${q} and requestId: "${requestId}"` : `requestId: "${requestId}"`; + q = hasValue ? `${q} and "${requestId}"` : `"${requestId}"`; } return q;