Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/client-cloudwatch-logs

Package Overview
Dependencies
Maintainers
5
Versions
432
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-cloudwatch-logs

AWS SDK for JavaScript Cloudwatch Logs Client for Node.js, Browser and React Native

  • 3.703.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3M
increased by17.7%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/client-cloudwatch-logs?

The @aws-sdk/client-cloudwatch-logs npm package allows developers to interact with the Amazon CloudWatch Logs service. This service provides monitoring, storing, and accessing log files from Amazon EC2 instances, AWS CloudTrail, and other sources. The package enables programmatic access to all the features of CloudWatch Logs, such as creating and managing log groups and streams, sending log events, and querying log data.

What are @aws-sdk/client-cloudwatch-logs's main functionalities?

Creating a Log Group

This feature allows you to create a new log group in CloudWatch Logs. A log group is a collection of log streams that share the same retention, monitoring, and access control settings.

const { CloudWatchLogsClient, CreateLogGroupCommand } = require('@aws-sdk/client-cloudwatch-logs');
const client = new CloudWatchLogsClient({ region: 'us-west-2' });
const command = new CreateLogGroupCommand({ logGroupName: 'my-log-group' });
client.send(command);

Creating a Log Stream

This feature allows you to create a log stream within a log group. A log stream represents a sequence of log events that share the same source.

const { CloudWatchLogsClient, CreateLogStreamCommand } = require('@aws-sdk/client-cloudwatch-logs');
const client = new CloudWatchLogsClient({ region: 'us-west-2' });
const command = new CreateLogStreamCommand({ logGroupName: 'my-log-group', logStreamName: 'my-log-stream' });
client.send(command);

Putting Log Events

This feature allows you to send log data to a log stream in CloudWatch Logs. Each log event consists of a timestamp and a message.

const { CloudWatchLogsClient, PutLogEventsCommand } = require('@aws-sdk/client-cloudwatch-logs');
const client = new CloudWatchLogsClient({ region: 'us-west-2' });
const command = new PutLogEventsCommand({
  logGroupName: 'my-log-group',
  logStreamName: 'my-log-stream',
  logEvents: [{ timestamp: Date.now(), message: 'This is a log message.' }]
});
client.send(command);

Searching and Filtering Log Data

This feature allows you to search and filter log data within a log group. You can specify a filter pattern, as well as a time range for the search.

const { CloudWatchLogsClient, FilterLogEventsCommand } = require('@aws-sdk/client-cloudwatch-logs');
const client = new CloudWatchLogsClient({ region: 'us-west-2' });
const command = new FilterLogEventsCommand({
  logGroupName: 'my-log-group',
  filterPattern: 'ERROR',
  startTime: Date.now() - 3600000,
  endTime: Date.now()
});
client.send(command);

Other packages similar to @aws-sdk/client-cloudwatch-logs

FAQs

Package last updated on 02 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc