aws-sdk#CloudWatchLogs TypeScript Examples

The following examples show how to use aws-sdk#CloudWatchLogs. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: sdk-calls.ts    From amplify-codegen with Apache License 2.0 6 votes vote down vote up
getCloudWatchLogs = async (region: string, logGroupName: string, logStreamName: string | undefined = undefined) => {
  const cloudwatchlogs = new CloudWatchLogs({ region, retryDelayOptions: { base: 500 } });

  let targetStreamName = logStreamName;
  if (targetStreamName === undefined) {
    const describeStreamsResp = await cloudwatchlogs
      .describeLogStreams({ logGroupName, descending: true, orderBy: 'LastEventTime' })
      .promise();
    if (describeStreamsResp.logStreams === undefined || describeStreamsResp.logStreams.length == 0) {
      return [];
    }

    targetStreamName = describeStreamsResp.logStreams[0].logStreamName;
  }

  const logsResp = await cloudwatchlogs.getLogEvents({ logGroupName, logStreamName: targetStreamName }).promise();
  return logsResp.events || [];
}
Example #2
Source File: ecs-client.ts    From crossfeed with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
constructor(isLocal?: boolean) {
    this.isLocal =
      isLocal ??
      (process.env.IS_OFFLINE || process.env.IS_LOCAL ? true : false);
    if (this.isLocal) {
      const Docker = require('dockerode');
      this.docker = new Docker();
    } else {
      this.ecs = new ECS();
      this.cloudWatchLogs = new CloudWatchLogs();
    }
  }
Example #3
Source File: ecs-client.ts    From crossfeed with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
cloudWatchLogs?: CloudWatchLogs;