diff --git a/packages/core/src/awsService/cloudWatchLogs/commands/tailLogGroup.ts b/packages/core/src/awsService/cloudWatchLogs/commands/tailLogGroup.ts index 74ac67fca33..6a41025be71 100644 --- a/packages/core/src/awsService/cloudWatchLogs/commands/tailLogGroup.ts +++ b/packages/core/src/awsService/cloudWatchLogs/commands/tailLogGroup.ts @@ -27,7 +27,7 @@ export async function tailLogGroup( } const liveTailSessionConfig: LiveTailSessionConfiguration = { - logGroupName: wizardResponse.regionLogGroupSubmenuResponse.data, + logGroupArn: wizardResponse.regionLogGroupSubmenuResponse.data, logStreamFilter: wizardResponse.logStreamFilter, logEventFilterPattern: wizardResponse.filterPattern, region: wizardResponse.regionLogGroupSubmenuResponse.region, diff --git a/packages/core/src/awsService/cloudWatchLogs/registry/liveTailSession.ts b/packages/core/src/awsService/cloudWatchLogs/registry/liveTailSession.ts index bb9aafe68db..e1e67be2a0b 100644 --- a/packages/core/src/awsService/cloudWatchLogs/registry/liveTailSession.ts +++ b/packages/core/src/awsService/cloudWatchLogs/registry/liveTailSession.ts @@ -9,13 +9,13 @@ import { StartLiveTailResponseStream, } from '@aws-sdk/client-cloudwatch-logs' import { LogStreamFilterResponse } from '../wizard/liveTailLogStreamSubmenu' -import { CloudWatchLogsSettings } from '../cloudWatchLogsUtils' -import { convertToTimeString, globals, Settings, ToolkitError } from '../../../shared' +import { CloudWatchLogsSettings, uriToKey } from '../cloudWatchLogsUtils' +import { convertToTimeString, getLogger, globals, Settings, ToolkitError } from '../../../shared' import { createLiveTailURIFromArgs } from './liveTailSessionRegistry' import { getUserAgent } from '../../../shared/telemetry/util' export type LiveTailSessionConfiguration = { - logGroupName: string + logGroupArn: string logStreamFilter?: LogStreamFilterResponse logEventFilterPattern?: string region: string @@ -28,7 +28,7 @@ export type LiveTailSessionClient = { export class LiveTailSession { private liveTailClient: LiveTailSessionClient - private _logGroupName: string + private _logGroupArn: string private logStreamFilter?: LogStreamFilterResponse private logEventFilterPattern?: string private _maxLines: number @@ -45,7 +45,7 @@ export class LiveTailSession { static settings = new CloudWatchLogsSettings(Settings.instance) public constructor(configuration: LiveTailSessionConfiguration) { - this._logGroupName = configuration.logGroupName + this._logGroupArn = configuration.logGroupArn this.logStreamFilter = configuration.logStreamFilter this.liveTailClient = { cwlClient: new CloudWatchLogsClient({ @@ -69,8 +69,8 @@ export class LiveTailSession { return this._uri } - public get logGroupName() { - return this._logGroupName + public get logGroupArn() { + return this._logGroupArn } public set eventRate(rate: number) { @@ -93,6 +93,7 @@ export class LiveTailSession { this.statusBarUpdateTimer = globals.clock.setInterval(() => { this.updateStatusBarItemText() }, 500) + getLogger().info(`LiveTail session started: ${uriToKey(this.uri)}`) return commandOutput.responseStream } @@ -130,7 +131,7 @@ export class LiveTailSession { } return new StartLiveTailCommand({ - logGroupIdentifiers: [this.logGroupName], + logGroupIdentifiers: [this.logGroupArn], logStreamNamePrefixes: logStreamNamePrefix ? [logStreamNamePrefix] : undefined, logStreamNames: logStreamName ? [logStreamName] : undefined, logEventFilterPattern: this.logEventFilterPattern ? this.logEventFilterPattern : undefined, diff --git a/packages/core/src/awsService/cloudWatchLogs/registry/liveTailSessionRegistry.ts b/packages/core/src/awsService/cloudWatchLogs/registry/liveTailSessionRegistry.ts index 3d5bc5c59a8..988725edc87 100644 --- a/packages/core/src/awsService/cloudWatchLogs/registry/liveTailSessionRegistry.ts +++ b/packages/core/src/awsService/cloudWatchLogs/registry/liveTailSessionRegistry.ts @@ -19,7 +19,7 @@ export class LiveTailSessionRegistry extends Map { } export function createLiveTailURIFromArgs(sessionData: LiveTailSessionConfiguration): vscode.Uri { - let uriStr = `${cloudwatchLogsLiveTailScheme}:${sessionData.region}:${sessionData.logGroupName}` + let uriStr = `${cloudwatchLogsLiveTailScheme}:${sessionData.region}:${sessionData.logGroupArn}` if (sessionData.logStreamFilter) { if (sessionData.logStreamFilter.type !== 'all') { diff --git a/packages/core/src/awsService/cloudWatchLogs/wizard/tailLogGroupWizard.ts b/packages/core/src/awsService/cloudWatchLogs/wizard/tailLogGroupWizard.ts index c0ba4bdc3af..cc07bc71961 100644 --- a/packages/core/src/awsService/cloudWatchLogs/wizard/tailLogGroupWizard.ts +++ b/packages/core/src/awsService/cloudWatchLogs/wizard/tailLogGroupWizard.ts @@ -4,7 +4,7 @@ */ import * as nls from 'vscode-nls' -import { ToolkitError } from '../../../shared' +import { globals, ToolkitError } from '../../../shared' import { DefaultCloudWatchLogsClient } from '../../../shared/clients/cloudWatchLogsClient' import { cwlFilterPatternHelpUrl } from '../../../shared/constants' import { createBackButton, createExitButton, createHelpButton } from '../../../shared/ui/buttons' @@ -29,7 +29,7 @@ export class TailLogGroupWizard extends Wizard { initState: { regionLogGroupSubmenuResponse: logGroupInfo ? { - data: logGroupInfo.groupName, + data: buildLogGroupArn(logGroupInfo.groupName, logGroupInfo.regionName), region: logGroupInfo.regionName, } : undefined, @@ -81,6 +81,19 @@ async function getLogGroupQuickPickOptions(regionCode: string): Promise