You are viewing the documentation for an older major version of the AWS SDK for JavaScript.
The modular AWS SDK for JavaScript (v3), the latest major version of AWS SDK for JavaScript, is now stable and recommended for general use. For more information, see the Migration Guide and API Reference.

Class: AWS.CloudWatchLogs

Inherits:
AWS.Service show all
Identifier:
cloudwatchlogs
API Version:
2014-03-28
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

You can use Amazon CloudWatch Logs to monitor, store, and access your log files from EC2 instances, CloudTrail, and other sources. You can then retrieve the associated log data from CloudWatch Logs using the CloudWatch console, CloudWatch Logs commands in the Amazon Web Services CLI, CloudWatch Logs API, or CloudWatch Logs SDK.

You can use CloudWatch Logs to:

  • Monitor logs from EC2 instances in real-time: You can use CloudWatch Logs to monitor applications and systems using log data. For example, CloudWatch Logs can track the number of errors that occur in your application logs and send you a notification whenever the rate of errors exceeds a threshold that you specify. CloudWatch Logs uses your log data for monitoring so no code changes are required. For example, you can monitor application logs for specific literal terms (such as "NullReferenceException") or count the number of occurrences of a literal term at a particular position in log data (such as "404" status codes in an Apache access log). When the term you are searching for is found, CloudWatch Logs reports the data to a CloudWatch metric that you specify.

  • Monitor CloudTrail logged events: You can create alarms in CloudWatch and receive notifications of particular API activity as captured by CloudTrail. You can use the notification to perform troubleshooting.

  • Archive log data: You can use CloudWatch Logs to store your log data in highly durable storage. You can change the log retention setting so that any log events older than this setting are automatically deleted. The CloudWatch Logs agent makes it easy to quickly send both rotated and non-rotated log data off of a host and into the log service. You can then access the raw log data when you need it.

Sending a Request Using CloudWatchLogs

var cloudwatchlogs = new AWS.CloudWatchLogs();
cloudwatchlogs.associateKmsKey(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the CloudWatchLogs object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var cloudwatchlogs = new AWS.CloudWatchLogs({apiVersion: '2014-03-28'});

You can also set the API version globally in AWS.config.apiVersions using the cloudwatchlogs service identifier:

AWS.config.apiVersions = {
  cloudwatchlogs: '2014-03-28',
  // other service API versions
};

var cloudwatchlogs = new AWS.CloudWatchLogs();

Version:

  • 2014-03-28

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.CloudWatchLogs(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a CloudWatchLogs object

var cloudwatchlogs = new AWS.CloudWatchLogs({apiVersion: '2014-03-28'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String|AWS.Endpoint)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com' or an Endpoint object.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.CloudWatchLogs.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.CloudWatchLogs.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.CloudWatchLogs.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

    when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to legacy

  • s3UseArnRegion (Boolean)

    whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to true

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The base option will be ignored if this option is supplied. The function is only called for retryable errors.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean|undefined)

    whether to call operations with endpoints given by service dynamically. Setting this

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

  • stsRegionalEndpoints ('legacy'|'regional')

    whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

associateKmsKey(params = {}, callback) ⇒ AWS.Request

Associates the specified Key Management Service customer master key (CMK) with the specified log group.

Associating an KMS CMK with a log group overrides any existing associations between the log group and a CMK. After a CMK is associated with a log group, all newly ingested data for the log group is encrypted using the CMK. This association is stored as long as the data encrypted with the CMK is still within CloudWatch Logs. This enables CloudWatch Logs to decrypt this data whenever it is requested.

CloudWatch Logs supports only symmetric CMKs. Do not use an associate an asymmetric CMK with your log group. For more information, see Using Symmetric and Asymmetric Keys.

It can take up to 5 minutes for this operation to take effect.

If you attempt to associate a CMK with a log group but the CMK does not exist or the CMK is disabled, you receive an InvalidParameterException error.

Service Reference:

Examples:

Calling the associateKmsKey operation

var params = {
  kmsKeyId: 'STRING_VALUE', /* required */
  logGroupName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.associateKmsKey(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

cancelExportTask(params = {}, callback) ⇒ AWS.Request

Cancels the specified export task.

The task must be in the PENDING or RUNNING state.

Service Reference:

Examples:

Calling the cancelExportTask operation

var params = {
  taskId: 'STRING_VALUE' /* required */
};
cloudwatchlogs.cancelExportTask(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • taskId — (String)

      The ID of the export task.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createExportTask(params = {}, callback) ⇒ AWS.Request

Creates an export task, which allows you to efficiently export data from a log group to an Amazon S3 bucket. When you perform a CreateExportTask operation, you must use credentials that have permission to write to the S3 bucket that you specify as the destination.

This is an asynchronous call. If all the required information is provided, this operation initiates an export task and responds with the ID of the task. After the task has started, you can use DescribeExportTasks to get the status of the export task. Each account can only have one active (RUNNING or PENDING) export task at a time. To cancel an export task, use CancelExportTask.

You can export logs from multiple log groups or multiple time ranges to the same S3 bucket. To separate out log data for each export task, you can specify a prefix to be used as the Amazon S3 key prefix for all exported objects.

Exporting to S3 buckets that are encrypted with AES-256 is supported. Exporting to S3 buckets encrypted with SSE-KMS is not supported.

Service Reference:

Examples:

Calling the createExportTask operation

var params = {
  destination: 'STRING_VALUE', /* required */
  from: 'NUMBER_VALUE', /* required */
  logGroupName: 'STRING_VALUE', /* required */
  to: 'NUMBER_VALUE', /* required */
  destinationPrefix: 'STRING_VALUE',
  logStreamNamePrefix: 'STRING_VALUE',
  taskName: 'STRING_VALUE'
};
cloudwatchlogs.createExportTask(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • taskName — (String)

      The name of the export task.

    • logGroupName — (String)

      The name of the log group.

    • logStreamNamePrefix — (String)

      Export only log streams that match the provided prefix. If you don't specify a value, no prefix filter is applied.

    • from — (Integer)

      The start time of the range for the request, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp earlier than this time are not exported.

    • to — (Integer)

      The end time of the range for the request, expreswatchlogsdocused as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not exported.

    • destination — (String)

      The name of S3 bucket for the exported log data. The bucket must be in the same Amazon Web Services region.

    • destinationPrefix — (String)

      The prefix used as the start of the key for every object exported. If you don't specify a value, the default is exportedlogs.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • taskId — (String)

        The ID of the export task.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createLogGroup(params = {}, callback) ⇒ AWS.Request

Creates a log group with the specified name. You can create up to 20,000 log groups per account.

You must use the following guidelines when naming a log group:

  • Log group names must be unique within a region for an Amazon Web Services account.

  • Log group names can be between 1 and 512 characters long.

  • Log group names consist of the following characters: a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), '.' (period), and '#' (number sign)

When you create a log group, by default the log events in the log group never expire. To set a retention policy so that events expire and are deleted after a specified time, use PutRetentionPolicy.

If you associate a Key Management Service customer master key (CMK) with the log group, ingested data is encrypted using the CMK. This association is stored as long as the data encrypted with the CMK is still within CloudWatch Logs. This enables CloudWatch Logs to decrypt this data whenever it is requested.

If you attempt to associate a CMK with the log group but the CMK does not exist or the CMK is disabled, you receive an InvalidParameterException error.

CloudWatch Logs supports only symmetric CMKs. Do not associate an asymmetric CMK with your log group. For more information, see Using Symmetric and Asymmetric Keys.

Service Reference:

Examples:

Calling the createLogGroup operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  kmsKeyId: 'STRING_VALUE',
  tags: {
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
cloudwatchlogs.createLogGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • kmsKeyId — (String)

      The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. For more information, see Amazon Resource Names - Key Management Service.

    • tags — (map<String>)

      The key-value pairs to use for the tags.

      CloudWatch Logs doesn’t support IAM policies that prevent users from assigning specified tags to log groups using the aws:Resource/key-name or aws:TagKeys condition keys. For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createLogStream(params = {}, callback) ⇒ AWS.Request

Creates a log stream for the specified log group. A log stream is a sequence of log events that originate from a single source, such as an application instance or a resource that is being monitored.

There is no limit on the number of log streams that you can create for a log group. There is a limit of 50 TPS on CreateLogStream operations, after which transactions are throttled.

You must use the following guidelines when naming a log stream:

  • Log stream names must be unique within the log group.

  • Log stream names can be between 1 and 512 characters long.

  • The ':' (colon) and '*' (asterisk) characters are not allowed.

Service Reference:

Examples:

Calling the createLogStream operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  logStreamName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.createLogStream(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • logStreamName — (String)

      The name of the log stream.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteDestination(params = {}, callback) ⇒ AWS.Request

Deletes the specified destination, and eventually disables all the subscription filters that publish to it. This operation does not delete the physical resource encapsulated by the destination.

Service Reference:

Examples:

Calling the deleteDestination operation

var params = {
  destinationName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.deleteDestination(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • destinationName — (String)

      The name of the destination.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteLogGroup(params = {}, callback) ⇒ AWS.Request

Deletes the specified log group and permanently deletes all the archived log events associated with the log group.

Service Reference:

Examples:

Calling the deleteLogGroup operation

var params = {
  logGroupName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.deleteLogGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteLogStream(params = {}, callback) ⇒ AWS.Request

Deletes the specified log stream and permanently deletes all the archived log events associated with the log stream.

Service Reference:

Examples:

Calling the deleteLogStream operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  logStreamName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.deleteLogStream(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • logStreamName — (String)

      The name of the log stream.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteMetricFilter(params = {}, callback) ⇒ AWS.Request

Deletes the specified metric filter.

Service Reference:

Examples:

Calling the deleteMetricFilter operation

var params = {
  filterName: 'STRING_VALUE', /* required */
  logGroupName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.deleteMetricFilter(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • filterName — (String)

      The name of the metric filter.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteQueryDefinition(params = {}, callback) ⇒ AWS.Request

Deletes a saved CloudWatch Logs Insights query definition. A query definition contains details about a saved CloudWatch Logs Insights query.

Each DeleteQueryDefinition operation can delete one query definition.

You must have the logs:DeleteQueryDefinition permission to be able to perform this operation.

Service Reference:

Examples:

Calling the deleteQueryDefinition operation

var params = {
  queryDefinitionId: 'STRING_VALUE' /* required */
};
cloudwatchlogs.deleteQueryDefinition(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • queryDefinitionId — (String)

      The ID of the query definition that you want to delete. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • success — (Boolean)

        A value of TRUE indicates that the operation succeeded. FALSE indicates that the operation failed.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteResourcePolicy(params = {}, callback) ⇒ AWS.Request

Deletes a resource policy from this account. This revokes the access of the identities in that policy to put log events to this account.

Service Reference:

Examples:

Calling the deleteResourcePolicy operation

var params = {
  policyName: 'STRING_VALUE'
};
cloudwatchlogs.deleteResourcePolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • policyName — (String)

      The name of the policy to be revoked. This parameter is required.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteRetentionPolicy(params = {}, callback) ⇒ AWS.Request

Deletes the specified retention policy.

Log events do not expire if they belong to log groups without a retention policy.

Service Reference:

Examples:

Calling the deleteRetentionPolicy operation

var params = {
  logGroupName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.deleteRetentionPolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteSubscriptionFilter(params = {}, callback) ⇒ AWS.Request

Deletes the specified subscription filter.

Service Reference:

Examples:

Calling the deleteSubscriptionFilter operation

var params = {
  filterName: 'STRING_VALUE', /* required */
  logGroupName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.deleteSubscriptionFilter(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • filterName — (String)

      The name of the subscription filter.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeDestinations(params = {}, callback) ⇒ AWS.Request

Lists all your destinations. The results are ASCII-sorted by destination name.

Service Reference:

Examples:

Calling the describeDestinations operation

var params = {
  DestinationNamePrefix: 'STRING_VALUE',
  limit: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE'
};
cloudwatchlogs.describeDestinations(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • DestinationNamePrefix — (String)

      The prefix to match. If you don't specify a value, no prefix filter is applied.

    • nextToken — (String)

      The token for the next set of items to return. (You received this token from a previous call.)

    • limit — (Integer)

      The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • destinations — (Array<map>)

        The destinations.

        • destinationName — (String)

          The name of the destination.

        • targetArn — (String)

          The Amazon Resource Name (ARN) of the physical target where the log events are delivered (for example, a Kinesis stream).

        • roleArn — (String)

          A role for impersonation, used when delivering log events to the target.

        • accessPolicy — (String)

          An IAM policy document that governs which Amazon Web Services accounts can create subscription filters against this destination.

        • arn — (String)

          The ARN of this destination.

        • creationTime — (Integer)

          The creation time of the destination, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

      • nextToken — (String)

        The token for the next set of items to return. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeExportTasks(params = {}, callback) ⇒ AWS.Request

Lists the specified export tasks. You can list all your export tasks or filter the results based on task ID or task status.

Service Reference:

Examples:

Calling the describeExportTasks operation

var params = {
  limit: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE',
  statusCode: CANCELLED | COMPLETED | FAILED | PENDING | PENDING_CANCEL | RUNNING,
  taskId: 'STRING_VALUE'
};
cloudwatchlogs.describeExportTasks(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • taskId — (String)

      The ID of the export task. Specifying a task ID filters the results to zero or one export tasks.

    • statusCode — (String)

      The status code of the export task. Specifying a status code filters the results to zero or more export tasks.

      Possible values include:
      • "CANCELLED"
      • "COMPLETED"
      • "FAILED"
      • "PENDING"
      • "PENDING_CANCEL"
      • "RUNNING"
    • nextToken — (String)

      The token for the next set of items to return. (You received this token from a previous call.)

    • limit — (Integer)

      The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • exportTasks — (Array<map>)

        The export tasks.

        • taskId — (String)

          The ID of the export task.

        • taskName — (String)

          The name of the export task.

        • logGroupName — (String)

          The name of the log group from which logs data was exported.

        • from — (Integer)

          The start time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp before this time are not exported.

        • to — (Integer)

          The end time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not exported.

        • destination — (String)

          The name of the S3 bucket to which the log data was exported.

        • destinationPrefix — (String)

          The prefix that was used as the start of Amazon S3 key for every object exported.

        • status — (map)

          The status of the export task.

          • code — (String)

            The status code of the export task.

            Possible values include:
            • "CANCELLED"
            • "COMPLETED"
            • "FAILED"
            • "PENDING"
            • "PENDING_CANCEL"
            • "RUNNING"
          • message — (String)

            The status message related to the status code.

        • executionInfo — (map)

          Execution information about the export task.

          • creationTime — (Integer)

            The creation time of the export task, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

          • completionTime — (Integer)

            The completion time of the export task, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

      • nextToken — (String)

        The token for the next set of items to return. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeLogGroups(params = {}, callback) ⇒ AWS.Request

Lists the specified log groups. You can list all your log groups or filter the results by prefix. The results are ASCII-sorted by log group name.

CloudWatch Logs doesn’t support IAM policies that control access to the DescribeLogGroups action by using the aws:ResourceTag/key-name condition key. Other CloudWatch Logs actions do support the use of the aws:ResourceTag/key-name condition key to control access. For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags.

Service Reference:

Examples:

Calling the describeLogGroups operation

var params = {
  limit: 'NUMBER_VALUE',
  logGroupNamePrefix: 'STRING_VALUE',
  nextToken: 'STRING_VALUE'
};
cloudwatchlogs.describeLogGroups(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupNamePrefix — (String)

      The prefix to match.

    • nextToken — (String)

      The token for the next set of items to return. (You received this token from a previous call.)

    • limit — (Integer)

      The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • logGroups — (Array<map>)

        The log groups.

        If the retentionInDays value if not included for a log group, then that log group is set to have its events never expire.

        • logGroupName — (String)

          The name of the log group.

        • creationTime — (Integer)

          The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

        • retentionInDays — (Integer)

          The number of days to retain the log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653.

          To set a log group to never have log events expire, use DeleteRetentionPolicy.

        • metricFilterCount — (Integer)

          The number of metric filters.

        • arn — (String)

          The Amazon Resource Name (ARN) of the log group.

        • storedBytes — (Integer)

          The number of bytes stored.

        • kmsKeyId — (String)

          The Amazon Resource Name (ARN) of the CMK to use when encrypting log data.

      • nextToken — (String)

        The token for the next set of items to return. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeLogStreams(params = {}, callback) ⇒ AWS.Request

Lists the log streams for the specified log group. You can list all the log streams or filter the results by prefix. You can also control how the results are ordered.

This operation has a limit of five transactions per second, after which transactions are throttled.

Service Reference:

Examples:

Calling the describeLogStreams operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  descending: true || false,
  limit: 'NUMBER_VALUE',
  logStreamNamePrefix: 'STRING_VALUE',
  nextToken: 'STRING_VALUE',
  orderBy: LogStreamName | LastEventTime
};
cloudwatchlogs.describeLogStreams(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • logStreamNamePrefix — (String)

      The prefix to match.

      If orderBy is LastEventTime, you cannot specify this parameter.

    • orderBy — (String)

      If the value is LogStreamName, the results are ordered by log stream name. If the value is LastEventTime, the results are ordered by the event time. The default value is LogStreamName.

      If you order the results by event time, you cannot specify the logStreamNamePrefix parameter.

      lastEventTimestamp represents the time of the most recent log event in the log stream in CloudWatch Logs. This number is expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. lastEventTimestamp updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but in rare situations might take longer.

      Possible values include:
      • "LogStreamName"
      • "LastEventTime"
    • descending — (Boolean)

      If the value is true, results are returned in descending order. If the value is to false, results are returned in ascending order. The default value is false.

    • nextToken — (String)

      The token for the next set of items to return. (You received this token from a previous call.)

    • limit — (Integer)

      The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • logStreams — (Array<map>)

        The log streams.

        • logStreamName — (String)

          The name of the log stream.

        • creationTime — (Integer)

          The creation time of the stream, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

        • firstEventTimestamp — (Integer)

          The time of the first event, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

        • lastEventTimestamp — (Integer)

          The time of the most recent log event in the log stream in CloudWatch Logs. This number is expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. The lastEventTime value updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but in rare situations might take longer.

        • lastIngestionTime — (Integer)

          The ingestion time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

        • uploadSequenceToken — (String)

          The sequence token.

        • arn — (String)

          The Amazon Resource Name (ARN) of the log stream.

        • storedBytes — (Integer)

          The number of bytes stored.

          Important: On June 17, 2019, this parameter was deprecated for log streams, and is always reported as zero. This change applies only to log streams. The storedBytes parameter for log groups is not affected.

      • nextToken — (String)

        The token for the next set of items to return. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeMetricFilters(params = {}, callback) ⇒ AWS.Request

Lists the specified metric filters. You can list all of the metric filters or filter the results by log name, prefix, metric name, or metric namespace. The results are ASCII-sorted by filter name.

Service Reference:

Examples:

Calling the describeMetricFilters operation

var params = {
  filterNamePrefix: 'STRING_VALUE',
  limit: 'NUMBER_VALUE',
  logGroupName: 'STRING_VALUE',
  metricName: 'STRING_VALUE',
  metricNamespace: 'STRING_VALUE',
  nextToken: 'STRING_VALUE'
};
cloudwatchlogs.describeMetricFilters(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • filterNamePrefix — (String)

      The prefix to match. CloudWatch Logs uses the value you set here only if you also include the logGroupName parameter in your request.

    • nextToken — (String)

      The token for the next set of items to return. (You received this token from a previous call.)

    • limit — (Integer)

      The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

    • metricName — (String)

      Filters results to include only those with the specified metric name. If you include this parameter in your request, you must also include the metricNamespace parameter.

    • metricNamespace — (String)

      Filters results to include only those in the specified namespace. If you include this parameter in your request, you must also include the metricName parameter.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • metricFilters — (Array<map>)

        The metric filters.

        • filterName — (String)

          The name of the metric filter.

        • filterPattern — (String)

          A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

        • metricTransformations — (Array<map>)

          The metric transformations.

          • metricNamerequired — (String)

            The name of the CloudWatch metric.

          • metricNamespacerequired — (String)

            A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.

          • metricValuerequired — (String)

            The value to publish to the CloudWatch metric when a filter pattern matches a log event.

          • defaultValue — (Float)

            (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.

          • dimensions — (map<String>)

            The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.

            Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as IPAddress or requestID as dimensions. Each different value found for a dimension is treated as a separate metric and accrues charges as a separate custom metric.

            To help prevent accidental high charges, Amazon disables a metric filter if it generates 1000 different name/value pairs for the dimensions that you have specified within a certain amount of time.

            You can also set up a billing alarm to alert you if your charges are higher than expected. For more information, see Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges.

          • unit — (String)

            The unit to assign to the metric. If you omit this, the unit is set as None.

            Possible values include:
            • "Seconds"
            • "Microseconds"
            • "Milliseconds"
            • "Bytes"
            • "Kilobytes"
            • "Megabytes"
            • "Gigabytes"
            • "Terabytes"
            • "Bits"
            • "Kilobits"
            • "Megabits"
            • "Gigabits"
            • "Terabits"
            • "Percent"
            • "Count"
            • "Bytes/Second"
            • "Kilobytes/Second"
            • "Megabytes/Second"
            • "Gigabytes/Second"
            • "Terabytes/Second"
            • "Bits/Second"
            • "Kilobits/Second"
            • "Megabits/Second"
            • "Gigabits/Second"
            • "Terabits/Second"
            • "Count/Second"
            • "None"
        • creationTime — (Integer)

          The creation time of the metric filter, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

        • logGroupName — (String)

          The name of the log group.

      • nextToken — (String)

        The token for the next set of items to return. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeQueries(params = {}, callback) ⇒ AWS.Request

Returns a list of CloudWatch Logs Insights queries that are scheduled, executing, or have been executed recently in this account. You can request all queries or limit it to queries of a specific log group or queries with a certain status.

Service Reference:

Examples:

Calling the describeQueries operation

var params = {
  logGroupName: 'STRING_VALUE',
  maxResults: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE',
  status: Scheduled | Running | Complete | Failed | Cancelled | Timeout | Unknown
};
cloudwatchlogs.describeQueries(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      Limits the returned queries to only those for the specified log group.

    • status — (String)

      Limits the returned queries to only those that have the specified status. Valid values are Cancelled, Complete, Failed, Running, and Scheduled.

      Possible values include:
      • "Scheduled"
      • "Running"
      • "Complete"
      • "Failed"
      • "Cancelled"
      • "Timeout"
      • "Unknown"
    • maxResults — (Integer)

      Limits the number of returned queries to the specified number.

    • nextToken — (String)

      The token for the next set of items to return. The token expires after 24 hours.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • queries — (Array<map>)

        The list of queries that match the request.

        • queryId — (String)

          The unique ID number of this query.

        • queryString — (String)

          The query string used in this query.

        • status — (String)

          The status of this query. Possible values are Cancelled, Complete, Failed, Running, Scheduled, and Unknown.

          Possible values include:
          • "Scheduled"
          • "Running"
          • "Complete"
          • "Failed"
          • "Cancelled"
          • "Timeout"
          • "Unknown"
        • createTime — (Integer)

          The date and time that this query was created.

        • logGroupName — (String)

          The name of the log group scanned by this query.

      • nextToken — (String)

        The token for the next set of items to return. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeQueryDefinitions(params = {}, callback) ⇒ AWS.Request

This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions.

You can use the queryDefinitionNamePrefix parameter to limit the results to only the query definitions that have names that start with a certain string.

Service Reference:

Examples:

Calling the describeQueryDefinitions operation

var params = {
  maxResults: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE',
  queryDefinitionNamePrefix: 'STRING_VALUE'
};
cloudwatchlogs.describeQueryDefinitions(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • queryDefinitionNamePrefix — (String)

      Use this parameter to filter your results to only the query definitions that have names that start with the prefix you specify.

    • maxResults — (Integer)

      Limits the number of returned query definitions to the specified number.

    • nextToken — (String)

      The token for the next set of items to return. The token expires after 24 hours.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • queryDefinitions — (Array<map>)

        The list of query definitions that match your request.

        • queryDefinitionId — (String)

          The unique ID of the query definition.

        • name — (String)

          The name of the query definition.

        • queryString — (String)

          The query string to use for this definition. For more information, see CloudWatch Logs Insights Query Syntax.

        • lastModified — (Integer)

          The date that the query definition was most recently modified.

        • logGroupNames — (Array<String>)

          If this query definition contains a list of log groups that it is limited to, that list appears here.

      • nextToken — (String)

        The token for the next set of items to return. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeResourcePolicies(params = {}, callback) ⇒ AWS.Request

Lists the resource policies in this account.

Service Reference:

Examples:

Calling the describeResourcePolicies operation

var params = {
  limit: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE'
};
cloudwatchlogs.describeResourcePolicies(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • nextToken — (String)

      The token for the next set of items to return. The token expires after 24 hours.

    • limit — (Integer)

      The maximum number of resource policies to be displayed with one call of this API.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • resourcePolicies — (Array<map>)

        The resource policies that exist in this account.

        • policyName — (String)

          The name of the resource policy.

        • policyDocument — (String)

          The details of the policy.

        • lastUpdatedTime — (Integer)

          Timestamp showing when this policy was last updated, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

      • nextToken — (String)

        The token for the next set of items to return. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeSubscriptionFilters(params = {}, callback) ⇒ AWS.Request

Lists the subscription filters for the specified log group. You can list all the subscription filters or filter the results by prefix. The results are ASCII-sorted by filter name.

Service Reference:

Examples:

Calling the describeSubscriptionFilters operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  filterNamePrefix: 'STRING_VALUE',
  limit: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE'
};
cloudwatchlogs.describeSubscriptionFilters(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • filterNamePrefix — (String)

      The prefix to match. If you don't specify a value, no prefix filter is applied.

    • nextToken — (String)

      The token for the next set of items to return. (You received this token from a previous call.)

    • limit — (Integer)

      The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • subscriptionFilters — (Array<map>)

        The subscription filters.

        • filterName — (String)

          The name of the subscription filter.

        • logGroupName — (String)

          The name of the log group.

        • filterPattern — (String)

          A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

        • destinationArn — (String)

          The Amazon Resource Name (ARN) of the destination.

        • roleArn — (String)

        • distribution — (String)

          The method used to distribute log data to the destination, which can be either random or grouped by log stream.

          Possible values include:
          • "Random"
          • "ByLogStream"
        • creationTime — (Integer)

          The creation time of the subscription filter, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

      • nextToken — (String)

        The token for the next set of items to return. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

disassociateKmsKey(params = {}, callback) ⇒ AWS.Request

Disassociates the associated Key Management Service customer master key (CMK) from the specified log group.

After the KMS CMK is disassociated from the log group, CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and CloudWatch Logs requires permissions for the CMK whenever the encrypted data is requested.

Note that it can take up to 5 minutes for this operation to take effect.

Service Reference:

Examples:

Calling the disassociateKmsKey operation

var params = {
  logGroupName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.disassociateKmsKey(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

filterLogEvents(params = {}, callback) ⇒ AWS.Request

Lists log events from the specified log group. You can list all the log events or filter the results using a filter pattern, a time range, and the name of the log stream.

By default, this operation returns as many log events as can fit in 1 MB (up to 10,000 log events) or all the events found within the time range that you specify. If the results include a token, then there are more log events available, and you can get additional results by specifying the token in a subsequent call. This operation can return empty results while there are more log events available through the token.

The returned log events are sorted by event timestamp, the timestamp when the event was ingested by CloudWatch Logs, and the ID of the PutLogEvents request.

Service Reference:

Examples:

Calling the filterLogEvents operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  endTime: 'NUMBER_VALUE',
  filterPattern: 'STRING_VALUE',
  interleaved: true || false,
  limit: 'NUMBER_VALUE',
  logStreamNamePrefix: 'STRING_VALUE',
  logStreamNames: [
    'STRING_VALUE',
    /* more items */
  ],
  nextToken: 'STRING_VALUE',
  startTime: 'NUMBER_VALUE'
};
cloudwatchlogs.filterLogEvents(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group to search.

    • logStreamNames — (Array<String>)

      Filters the results to only logs from the log streams in this list.

      If you specify a value for both logStreamNamePrefix and logStreamNames, the action returns an InvalidParameterException error.

    • logStreamNamePrefix — (String)

      Filters the results to include only events from log streams that have names starting with this prefix.

      If you specify a value for both logStreamNamePrefix and logStreamNames, but the value for logStreamNamePrefix does not match any log stream names specified in logStreamNames, the action returns an InvalidParameterException error.

    • startTime — (Integer)

      The start of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp before this time are not returned.

    • endTime — (Integer)

      The end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not returned.

    • filterPattern — (String)

      The filter pattern to use. For more information, see Filter and Pattern Syntax.

      If not provided, all the events are matched.

    • nextToken — (String)

      The token for the next set of events to return. (You received this token from a previous call.)

    • limit — (Integer)

      The maximum number of events to return. The default is 10,000 events.

    • interleaved — (Boolean)

      If the value is true, the operation makes a best effort to provide responses that contain events from multiple log streams within the log group, interleaved in a single response. If the value is false, all the matched log events in the first log stream are searched first, then those in the next log stream, and so on. The default is false.

      Important: Starting on June 17, 2019, this parameter is ignored and the value is assumed to be true. The response from this operation always interleaves events from multiple log streams within a log group.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • events — (Array<map>)

        The matched events.

        • logStreamName — (String)

          The name of the log stream to which this event belongs.

        • timestamp — (Integer)

          The time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

        • message — (String)

          The data contained in the log event.

        • ingestionTime — (Integer)

          The time the event was ingested, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

        • eventId — (String)

          The ID of the event.

      • searchedLogStreams — (Array<map>)

        IMPORTANT Starting on May 15, 2020, this parameter will be deprecated. This parameter will be an empty list after the deprecation occurs.

        Indicates which log streams have been searched and whether each has been searched completely.

        • logStreamName — (String)

          The name of the log stream.

        • searchedCompletely — (Boolean)

          Indicates whether all the events in this log stream were searched.

      • nextToken — (String)

        The token to use when requesting the next set of items. The token expires after 24 hours.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getLogEvents(params = {}, callback) ⇒ AWS.Request

Lists log events from the specified log stream. You can list all of the log events or filter using a time range.

By default, this operation returns as many log events as can fit in a response size of 1MB (up to 10,000 log events). You can get additional log events by specifying one of the tokens in a subsequent call. This operation can return empty results while there are more log events available through the token.

Service Reference:

Examples:

Calling the getLogEvents operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  logStreamName: 'STRING_VALUE', /* required */
  endTime: 'NUMBER_VALUE',
  limit: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE',
  startFromHead: true || false,
  startTime: 'NUMBER_VALUE'
};
cloudwatchlogs.getLogEvents(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • logStreamName — (String)

      The name of the log stream.

    • startTime — (Integer)

      The start of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp equal to this time or later than this time are included. Events with a timestamp earlier than this time are not included.

    • endTime — (Integer)

      The end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp equal to or later than this time are not included.

    • nextToken — (String)

      The token for the next set of items to return. (You received this token from a previous call.)

    • limit — (Integer)

      The maximum number of log events returned. If you don't specify a value, the maximum is as many log events as can fit in a response size of 1 MB, up to 10,000 log events.

    • startFromHead — (Boolean)

      If the value is true, the earliest log events are returned first. If the value is false, the latest log events are returned first. The default value is false.

      If you are using a previous nextForwardToken value as the nextToken in this operation, you must specify true for startFromHead.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • events — (Array<map>)

        The events.

        • timestamp — (Integer)

          The time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

        • message — (String)

          The data contained in the log event.

        • ingestionTime — (Integer)

          The time the event was ingested, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

      • nextForwardToken — (String)

        The token for the next set of items in the forward direction. The token expires after 24 hours. If you have reached the end of the stream, it returns the same token you passed in.

      • nextBackwardToken — (String)

        The token for the next set of items in the backward direction. The token expires after 24 hours. This token is never null. If you have reached the end of the stream, it returns the same token you passed in.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getLogGroupFields(params = {}, callback) ⇒ AWS.Request

Returns a list of the fields that are included in log events in the specified log group, along with the percentage of log events that contain each field. The search is limited to a time period that you specify.

In the results, fields that start with @ are fields generated by CloudWatch Logs. For example, @timestamp is the timestamp of each log event. For more information about the fields that are generated by CloudWatch logs, see Supported Logs and Discovered Fields.

The response results are sorted by the frequency percentage, starting with the highest percentage.

Service Reference:

Examples:

Calling the getLogGroupFields operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  time: 'NUMBER_VALUE'
};
cloudwatchlogs.getLogGroupFields(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group to search.

    • time — (Integer)

      The time to set as the center of the query. If you specify time, the 15 minutes before this time are queries. If you omit time the 8 minutes before and 8 minutes after this time are searched.

      The time value is specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • logGroupFields — (Array<map>)

        The array of fields found in the query. Each object in the array contains the name of the field, along with the percentage of time it appeared in the log events that were queried.

        • name — (String)

          The name of a log field.

        • percent — (Integer)

          The percentage of log events queried that contained the field.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getLogRecord(params = {}, callback) ⇒ AWS.Request

Retrieves all of the fields and values of a single log event. All fields are retrieved, even if the original query that produced the logRecordPointer retrieved only a subset of fields. Fields are returned as field name/field value pairs.

The full unparsed log event is returned within @message.

Service Reference:

Examples:

Calling the getLogRecord operation

var params = {
  logRecordPointer: 'STRING_VALUE' /* required */
};
cloudwatchlogs.getLogRecord(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logRecordPointer — (String)

      The pointer corresponding to the log event record you want to retrieve. You get this from the response of a GetQueryResults operation. In that response, the value of the @ptr field for a log event is the value to use as logRecordPointer to retrieve that complete log event record.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • logRecord — (map<String>)

        The requested log event, as a JSON string.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getQueryResults(params = {}, callback) ⇒ AWS.Request

Returns the results from the specified query.

Only the fields requested in the query are returned, along with a @ptr field, which is the identifier for the log record. You can use the value of @ptr in a GetLogRecord operation to get the full log record.

GetQueryResults does not start a query execution. To run a query, use StartQuery.

If the value of the Status field in the output is Running, this operation returns only partial results. If you see a value of Scheduled or Running for the status, you can retry the operation later to see the final results.

Service Reference:

Examples:

Calling the getQueryResults operation

var params = {
  queryId: 'STRING_VALUE' /* required */
};
cloudwatchlogs.getQueryResults(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • queryId — (String)

      The ID number of the query.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • results — (Array<Array<map>>)

        The log events that matched the query criteria during the most recent time it ran.

        The results value is an array of arrays. Each log event is one object in the top-level array. Each of these log event objects is an array of field/value pairs.

        • field — (String)

          The log event field.

        • value — (String)

          The value of this field.

      • statistics — (map)

        Includes the number of log events scanned by the query, the number of log events that matched the query criteria, and the total number of bytes in the log events that were scanned. These values reflect the full raw results of the query.

        • recordsMatched — (Float)

          The number of log events that matched the query string.

        • recordsScanned — (Float)

          The total number of log events scanned during the query.

        • bytesScanned — (Float)

          The total number of bytes in the log events scanned during the query.

      • status — (String)

        The status of the most recent running of the query. Possible values are Cancelled, Complete, Failed, Running, Scheduled, Timeout, and Unknown.

        Queries time out after 15 minutes of execution. To avoid having your queries time out, reduce the time range being searched or partition your query into a number of queries.

        Possible values include:
        • "Scheduled"
        • "Running"
        • "Complete"
        • "Failed"
        • "Cancelled"
        • "Timeout"
        • "Unknown"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listTagsLogGroup(params = {}, callback) ⇒ AWS.Request

Lists the tags for the specified log group.

Service Reference:

Examples:

Calling the listTagsLogGroup operation

var params = {
  logGroupName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.listTagsLogGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • tags — (map<String>)

        The tags for the log group.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putDestination(params = {}, callback) ⇒ AWS.Request

Creates or updates a destination. This operation is used only to create destinations for cross-account subscriptions.

A destination encapsulates a physical resource (such as an Amazon Kinesis stream) and enables you to subscribe to a real-time stream of log events for a different account, ingested using PutLogEvents.

Through an access policy, a destination controls what is written to it. By default, PutDestination does not set any access policy with the destination, which means a cross-account user cannot call PutSubscriptionFilter against this destination. To enable this, the destination owner must call PutDestinationPolicy after PutDestination.

To perform a PutDestination operation, you must also have the iam:PassRole permission.

Service Reference:

Examples:

Calling the putDestination operation

var params = {
  destinationName: 'STRING_VALUE', /* required */
  roleArn: 'STRING_VALUE', /* required */
  targetArn: 'STRING_VALUE' /* required */
};
cloudwatchlogs.putDestination(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • destinationName — (String)

      A name for the destination.

    • targetArn — (String)

      The ARN of an Amazon Kinesis stream to which to deliver matching log events.

    • roleArn — (String)

      The ARN of an IAM role that grants CloudWatch Logs permissions to call the Amazon Kinesis PutRecord operation on the destination stream.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • destination — (map)

        The destination.

        • destinationName — (String)

          The name of the destination.

        • targetArn — (String)

          The Amazon Resource Name (ARN) of the physical target where the log events are delivered (for example, a Kinesis stream).

        • roleArn — (String)

          A role for impersonation, used when delivering log events to the target.

        • accessPolicy — (String)

          An IAM policy document that governs which Amazon Web Services accounts can create subscription filters against this destination.

        • arn — (String)

          The ARN of this destination.

        • creationTime — (Integer)

          The creation time of the destination, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putDestinationPolicy(params = {}, callback) ⇒ AWS.Request

Creates or updates an access policy associated with an existing destination. An access policy is an IAM policy document that is used to authorize claims to register a subscription filter against a given destination.

If multiple Amazon Web Services accounts are sending logs to this destination, each sender account must be listed separately in the policy. The policy does not support specifying * as the Principal or the use of the aws:PrincipalOrgId global key.

Service Reference:

Examples:

Calling the putDestinationPolicy operation

var params = {
  accessPolicy: 'STRING_VALUE', /* required */
  destinationName: 'STRING_VALUE' /* required */
};
cloudwatchlogs.putDestinationPolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • destinationName — (String)

      A name for an existing destination.

    • accessPolicy — (String)

      An IAM policy document that authorizes cross-account users to deliver their log events to the associated destination. This can be up to 5120 bytes.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putLogEvents(params = {}, callback) ⇒ AWS.Request

Uploads a batch of log events to the specified log stream.

You must include the sequence token obtained from the response of the previous call. An upload in a newly created log stream does not require a sequence token. You can also get the sequence token in the expectedSequenceToken field from InvalidSequenceTokenException. If you call PutLogEvents twice within a narrow time period using the same value for sequenceToken, both calls might be successful or one might be rejected.

The batch of events must satisfy the following constraints:

  • The maximum batch size is 1,048,576 bytes. This size is calculated as the sum of all event messages in UTF-8, plus 26 bytes for each log event.

  • None of the log events in the batch can be more than 2 hours in the future.

  • None of the log events in the batch can be older than 14 days or older than the retention period of the log group.

  • The log events in the batch must be in chronological order by their timestamp. The timestamp is the time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. (In Amazon Web Services Tools for PowerShell and the Amazon Web Services SDK for .NET, the timestamp is specified in .NET format: yyyy-mm-ddThh:mm:ss. For example, 2017-09-15T13:45:30.)

  • A batch of log events in a single request cannot span more than 24 hours. Otherwise, the operation fails.

  • The maximum number of log events in a batch is 10,000.

  • There is a quota of 5 requests per second per log stream. Additional requests are throttled. This quota can't be changed.

If a call to PutLogEvents returns "UnrecognizedClientException" the most likely cause is an invalid Amazon Web Services access key ID or secret key.

Service Reference:

Examples:

Calling the putLogEvents operation

var params = {
  logEvents: [ /* required */
    {
      message: 'STRING_VALUE', /* required */
      timestamp: 'NUMBER_VALUE' /* required */
    },
    /* more items */
  ],
  logGroupName: 'STRING_VALUE', /* required */
  logStreamName: 'STRING_VALUE', /* required */
  sequenceToken: 'STRING_VALUE'
};
cloudwatchlogs.putLogEvents(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • logStreamName — (String)

      The name of the log stream.

    • logEvents — (Array<map>)

      The log events.

      • timestamprequired — (Integer)

        The time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

      • messagerequired — (String)

        The raw event message.

    • sequenceToken — (String)

      The sequence token obtained from the response of the previous PutLogEvents call. An upload in a newly created log stream does not require a sequence token. You can also get the sequence token using DescribeLogStreams. If you call PutLogEvents twice within a narrow time period using the same value for sequenceToken, both calls might be successful or one might be rejected.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • nextSequenceToken — (String)

        The next sequence token.

      • rejectedLogEventsInfo — (map)

        The rejected events.

        • tooNewLogEventStartIndex — (Integer)

          The log events that are too new.

        • tooOldLogEventEndIndex — (Integer)

          The log events that are too old.

        • expiredLogEventEndIndex — (Integer)

          The expired log events.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putMetricFilter(params = {}, callback) ⇒ AWS.Request

Creates or updates a metric filter and associates it with the specified log group. Metric filters allow you to configure rules to extract metric data from log events ingested through PutLogEvents.

The maximum number of metric filters that can be associated with a log group is 100.

When you create a metric filter, you can also optionally assign a unit and dimensions to the metric that is created.

Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as IPAddress or requestID as dimensions. Each different value found for a dimension is treated as a separate metric and accrues charges as a separate custom metric.

To help prevent accidental high charges, Amazon disables a metric filter if it generates 1000 different name/value pairs for the dimensions that you have specified within a certain amount of time.

You can also set up a billing alarm to alert you if your charges are higher than expected. For more information, see Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges.

Service Reference:

Examples:

Calling the putMetricFilter operation

var params = {
  filterName: 'STRING_VALUE', /* required */
  filterPattern: 'STRING_VALUE', /* required */
  logGroupName: 'STRING_VALUE', /* required */
  metricTransformations: [ /* required */
    {
      metricName: 'STRING_VALUE', /* required */
      metricNamespace: 'STRING_VALUE', /* required */
      metricValue: 'STRING_VALUE', /* required */
      defaultValue: 'NUMBER_VALUE',
      dimensions: {
        '<DimensionsKey>': 'STRING_VALUE',
        /* '<DimensionsKey>': ... */
      },
      unit: Seconds | Microseconds | Milliseconds | Bytes | Kilobytes | Megabytes | Gigabytes | Terabytes | Bits | Kilobits | Megabits | Gigabits | Terabits | Percent | Count | Bytes/Second | Kilobytes/Second | Megabytes/Second | Gigabytes/Second | Terabytes/Second | Bits/Second | Kilobits/Second | Megabits/Second | Gigabits/Second | Terabits/Second | Count/Second | None
    },
    /* more items */
  ]
};
cloudwatchlogs.putMetricFilter(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • filterName — (String)

      A name for the metric filter.

    • filterPattern — (String)

      A filter pattern for extracting metric data out of ingested log events.

    • metricTransformations — (Array<map>)

      A collection of information that defines how metric data gets emitted.

      • metricNamerequired — (String)

        The name of the CloudWatch metric.

      • metricNamespacerequired — (String)

        A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.

      • metricValuerequired — (String)

        The value to publish to the CloudWatch metric when a filter pattern matches a log event.

      • defaultValue — (Float)

        (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.

      • dimensions — (map<String>)

        The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.

        Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as IPAddress or requestID as dimensions. Each different value found for a dimension is treated as a separate metric and accrues charges as a separate custom metric.

        To help prevent accidental high charges, Amazon disables a metric filter if it generates 1000 different name/value pairs for the dimensions that you have specified within a certain amount of time.

        You can also set up a billing alarm to alert you if your charges are higher than expected. For more information, see Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges.

      • unit — (String)

        The unit to assign to the metric. If you omit this, the unit is set as None.

        Possible values include:
        • "Seconds"
        • "Microseconds"
        • "Milliseconds"
        • "Bytes"
        • "Kilobytes"
        • "Megabytes"
        • "Gigabytes"
        • "Terabytes"
        • "Bits"
        • "Kilobits"
        • "Megabits"
        • "Gigabits"
        • "Terabits"
        • "Percent"
        • "Count"
        • "Bytes/Second"
        • "Kilobytes/Second"
        • "Megabytes/Second"
        • "Gigabytes/Second"
        • "Terabytes/Second"
        • "Bits/Second"
        • "Kilobits/Second"
        • "Megabits/Second"
        • "Gigabits/Second"
        • "Terabits/Second"
        • "Count/Second"
        • "None"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putQueryDefinition(params = {}, callback) ⇒ AWS.Request

Creates or updates a query definition for CloudWatch Logs Insights. For more information, see Analyzing Log Data with CloudWatch Logs Insights.

To update a query definition, specify its queryDefinitionId in your request. The values of name, queryString, and logGroupNames are changed to the values that you specify in your update operation. No current values are retained from the current query definition. For example, if you update a current query definition that includes log groups, and you don't specify the logGroupNames parameter in your update operation, the query definition changes to contain no log groups.

You must have the logs:PutQueryDefinition permission to be able to perform this operation.

Service Reference:

Examples:

Calling the putQueryDefinition operation

var params = {
  name: 'STRING_VALUE', /* required */
  queryString: 'STRING_VALUE', /* required */
  logGroupNames: [
    'STRING_VALUE',
    /* more items */
  ],
  queryDefinitionId: 'STRING_VALUE'
};
cloudwatchlogs.putQueryDefinition(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • name — (String)

      A name for the query definition. If you are saving a lot of query definitions, we recommend that you name them so that you can easily find the ones you want by using the first part of the name as a filter in the queryDefinitionNamePrefix parameter of DescribeQueryDefinitions.

    • queryDefinitionId — (String)

      If you are updating a query definition, use this parameter to specify the ID of the query definition that you want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.

      If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID for the new query definition and include it in the response to this operation.

    • logGroupNames — (Array<String>)

      Use this parameter to include specific log groups as part of your query definition.

      If you are updating a query definition and you omit this parameter, then the updated definition will contain no log groups.

    • queryString — (String)

      The query string to use for this definition. For more information, see CloudWatch Logs Insights Query Syntax.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • queryDefinitionId — (String)

        The ID of the query definition.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putResourcePolicy(params = {}, callback) ⇒ AWS.Request

Creates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53. An account can have up to 10 resource policies per Amazon Web Services Region.

Service Reference:

Examples:

Calling the putResourcePolicy operation

var params = {
  policyDocument: 'STRING_VALUE',
  policyName: 'STRING_VALUE'
};
cloudwatchlogs.putResourcePolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • policyName — (String)

      Name of the new policy. This parameter is required.

    • policyDocument — (String)

      Details of the new policy, including the identity of the principal that is enabled to put logs to this account. This is formatted as a JSON string. This parameter is required.

      The following example creates a resource policy enabling the Route 53 service to put DNS query logs in to the specified log group. Replace "logArn" with the ARN of your CloudWatch Logs resource, such as a log group or log stream.

      CloudWatch Logs also supports aws:SourceArn and aws:SourceAccount condition context keys.

      In the example resource policy, you would replace the value of SourceArn with the resource making the call from Route 53 to CloudWatch Logs and replace the value of SourceAccount with the Amazon Web Services account ID making that call.

      { "Version": "2012-10-17", "Statement": [ { "Sid": "Route53LogsToCloudWatchLogs", "Effect": "Allow", "Principal": { "Service": [ "route53.amazonaws.com" ] }, "Action": "logs:PutLogEvents", "Resource": "logArn", "Condition": { "ArnLike": { "aws:SourceArn": "myRoute53ResourceArn" }, "StringEquals": { "aws:SourceAccount": "myAwsAccountId" } } } ] }

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • resourcePolicy — (map)

        The new policy.

        • policyName — (String)

          The name of the resource policy.

        • policyDocument — (String)

          The details of the policy.

        • lastUpdatedTime — (Integer)

          Timestamp showing when this policy was last updated, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putRetentionPolicy(params = {}, callback) ⇒ AWS.Request

Sets the retention of the specified log group. A retention policy allows you to configure the number of days for which to retain log events in the specified log group.

Service Reference:

Examples:

Calling the putRetentionPolicy operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  retentionInDays: 'NUMBER_VALUE' /* required */
};
cloudwatchlogs.putRetentionPolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • retentionInDays — (Integer)

      The number of days to retain the log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653.

      To set a log group to never have log events expire, use DeleteRetentionPolicy.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putSubscriptionFilter(params = {}, callback) ⇒ AWS.Request

Creates or updates a subscription filter and associates it with the specified log group. Subscription filters allow you to subscribe to a real-time stream of log events ingested through PutLogEvents and have them delivered to a specific destination. When log events are sent to the receiving service, they are Base64 encoded and compressed with the gzip format.

The following destinations are supported for subscription filters:

  • An Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.

  • A logical destination that belongs to a different account, for cross-account delivery.

  • An Amazon Kinesis Firehose delivery stream that belongs to the same account as the subscription filter, for same-account delivery.

  • An Lambda function that belongs to the same account as the subscription filter, for same-account delivery.

Each log group can have up to two subscription filters associated with it. If you are updating an existing filter, you must specify the correct name in filterName.

To perform a PutSubscriptionFilter operation, you must also have the iam:PassRole permission.

Service Reference:

Examples:

Calling the putSubscriptionFilter operation

var params = {
  destinationArn: 'STRING_VALUE', /* required */
  filterName: 'STRING_VALUE', /* required */
  filterPattern: 'STRING_VALUE', /* required */
  logGroupName: 'STRING_VALUE', /* required */
  distribution: Random | ByLogStream,
  roleArn: 'STRING_VALUE'
};
cloudwatchlogs.putSubscriptionFilter(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • filterName — (String)

      A name for the subscription filter. If you are updating an existing filter, you must specify the correct name in filterName. To find the name of the filter currently associated with a log group, use DescribeSubscriptionFilters.

    • filterPattern — (String)

      A filter pattern for subscribing to a filtered stream of log events.

    • destinationArn — (String)

      The ARN of the destination to deliver matching log events to. Currently, the supported destinations are:

      • An Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.

      • A logical destination (specified using an ARN) belonging to a different account, for cross-account delivery.

        If you are setting up a cross-account subscription, the destination must have an IAM policy associated with it that allows the sender to send logs to the destination. For more information, see PutDestinationPolicy.

      • An Amazon Kinesis Firehose delivery stream belonging to the same account as the subscription filter, for same-account delivery.

      • A Lambda function belonging to the same account as the subscription filter, for same-account delivery.

    • roleArn — (String)

      The ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.

    • distribution — (String)

      The method used to distribute log data to the destination. By default, log data is grouped by log stream, but the grouping can be set to random for a more even distribution. This property is only applicable when the destination is an Amazon Kinesis stream.

      Possible values include:
      • "Random"
      • "ByLogStream"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

startQuery(params = {}, callback) ⇒ AWS.Request

Schedules a query of a log group using CloudWatch Logs Insights. You specify the log group and time range to query and the query string to use.

For more information, see CloudWatch Logs Insights Query Syntax.

Queries time out after 15 minutes of execution. If your queries are timing out, reduce the time range being searched or partition your query into a number of queries.

Service Reference:

Examples:

Calling the startQuery operation

var params = {
  endTime: 'NUMBER_VALUE', /* required */
  queryString: 'STRING_VALUE', /* required */
  startTime: 'NUMBER_VALUE', /* required */
  limit: 'NUMBER_VALUE',
  logGroupName: 'STRING_VALUE',
  logGroupNames: [
    'STRING_VALUE',
    /* more items */
  ]
};
cloudwatchlogs.startQuery(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The log group on which to perform the query.

      A StartQuery operation must include a logGroupNames or a logGroupName parameter, but not both.

    • logGroupNames — (Array<String>)

      The list of log groups to be queried. You can include up to 20 log groups.

      A StartQuery operation must include a logGroupNames or a logGroupName parameter, but not both.

    • startTime — (Integer)

      The beginning of the time range to query. The range is inclusive, so the specified start time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.

    • endTime — (Integer)

      The end of the time range to query. The range is inclusive, so the specified end time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.

    • queryString — (String)

      The query string to use. For more information, see CloudWatch Logs Insights Query Syntax.

    • limit — (Integer)

      The maximum number of log events to return in the query. If the query string uses the fields command, only the specified fields and their values are returned. The default is 1000.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • queryId — (String)

        The unique ID of the query.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

stopQuery(params = {}, callback) ⇒ AWS.Request

Stops a CloudWatch Logs Insights query that is in progress. If the query has already ended, the operation returns an error indicating that the specified query is not running.

Service Reference:

Examples:

Calling the stopQuery operation

var params = {
  queryId: 'STRING_VALUE' /* required */
};
cloudwatchlogs.stopQuery(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • queryId — (String)

      The ID number of the query to stop. To find this ID number, use DescribeQueries.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • success — (Boolean)

        This is true if the query was stopped by the StopQuery operation.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

tagLogGroup(params = {}, callback) ⇒ AWS.Request

Adds or updates the specified tags for the specified log group.

To list the tags for a log group, use ListTagsLogGroup. To remove tags, use UntagLogGroup.

For more information about tags, see Tag Log Groups in Amazon CloudWatch Logs in the Amazon CloudWatch Logs User Guide.

CloudWatch Logs doesn’t support IAM policies that prevent users from assigning specified tags to log groups using the aws:Resource/key-name or aws:TagKeys condition keys. For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags.

Service Reference:

Examples:

Calling the tagLogGroup operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  tags: { /* required */
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
cloudwatchlogs.tagLogGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • tags — (map<String>)

      The key-value pairs to use for the tags.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

testMetricFilter(params = {}, callback) ⇒ AWS.Request

Tests the filter pattern of a metric filter against a sample of log event messages. You can use this operation to validate the correctness of a metric filter pattern.

Service Reference:

Examples:

Calling the testMetricFilter operation

var params = {
  filterPattern: 'STRING_VALUE', /* required */
  logEventMessages: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
cloudwatchlogs.testMetricFilter(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • filterPattern — (String)

      A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

    • logEventMessages — (Array<String>)

      The log event messages to test.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • matches — (Array<map>)

        The matched events.

        • eventNumber — (Integer)

          The event number.

        • eventMessage — (String)

          The raw event data.

        • extractedValues — (map<String>)

          The values extracted from the event data by the filter.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

untagLogGroup(params = {}, callback) ⇒ AWS.Request

Removes the specified tags from the specified log group.

To list the tags for a log group, use ListTagsLogGroup. To add tags, use TagLogGroup.

CloudWatch Logs doesn’t support IAM policies that prevent users from assigning specified tags to log groups using the aws:Resource/key-name or aws:TagKeys condition keys.

Service Reference:

Examples:

Calling the untagLogGroup operation

var params = {
  logGroupName: 'STRING_VALUE', /* required */
  tags: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
cloudwatchlogs.untagLogGroup(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • logGroupName — (String)

      The name of the log group.

    • tags — (Array<String>)

      The tag keys. The corresponding tags are removed from the log group.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.