Class CloudWatchLogsClient
Client to interact with Amazon CloudWatch Logs
- Guzzle\Common\AbstractHasDispatcher implements Guzzle\Common\HasDispatcherInterface
-
Guzzle\Http\Client implements Guzzle\Http\ClientInterface
-
Guzzle\Service\Client implements Guzzle\Service\ClientInterface
-
Aws\Common\Client\AbstractClient implements Aws\Common\Client\AwsClientInterface
-
Aws\CloudWatchLogs\CloudWatchLogsClient
Link: User guide
Link: API docs
Located at Aws/CloudWatchLogs/CloudWatchLogsClient.php
Methods summary
-
public static
factory ( array $config = array() )
Executes the TestMetricFilter operation.
-
public
cancelExportTask ( array $args = array() )
Executes the CancelExportTask operation.
-
public
createExportTask ( array $args = array() )
Executes the CreateExportTask operation.
-
public
createLogGroup ( array $args = array() )
Executes the CreateLogGroup operation.
-
public
createLogStream ( array $args = array() )
Executes the CreateLogStream operation.
-
public
deleteDestination ( array $args = array() )
Executes the DeleteDestination operation.
-
public
deleteLogGroup ( array $args = array() )
Executes the DeleteLogGroup operation.
-
public
deleteLogStream ( array $args = array() )
Executes the DeleteLogStream operation.
-
public
deleteMetricFilter ( array $args = array() )
Executes the DeleteMetricFilter operation.
-
public
deleteRetentionPolicy ( array $args = array() )
Executes the DeleteRetentionPolicy operation.
-
public
deleteSubscriptionFilter ( array $args = array() )
Executes the DeleteSubscriptionFilter operation.
-
public
describeDestinations ( array $args = array() )
Executes the DescribeDestinations operation.
-
public
describeExportTasks ( array $args = array() )
Executes the DescribeExportTasks operation.
-
public
describeLogGroups ( array $args = array() )
Executes the DescribeLogGroups operation.
-
public
describeLogStreams ( array $args = array() )
Executes the DescribeLogStreams operation.
-
public
describeMetricFilters ( array $args = array() )
Executes the DescribeMetricFilters operation.
-
public
describeSubscriptionFilters ( array $args = array() )
Executes the DescribeSubscriptionFilters operation.
-
public
filterLogEvents ( array $args = array() )
Executes the FilterLogEvents operation.
-
public
getLogEvents ( array $args = array() )
Executes the GetLogEvents operation.
-
public
putDestination ( array $args = array() )
Executes the PutDestination operation.
-
public
putDestinationPolicy ( array $args = array() )
Executes the PutDestinationPolicy operation.
-
public
putLogEvents ( array $args = array() )
Executes the PutLogEvents operation.
-
public
putMetricFilter ( array $args = array() )
Executes the PutMetricFilter operation.
-
public
putRetentionPolicy ( array $args = array() )
Executes the PutRetentionPolicy operation.
-
public
putSubscriptionFilter ( array $args = array() )
Executes the PutSubscriptionFilter operation.
-
public
testMetricFilter ( array $args = array() )
Executes the TestMetricFilter operation.
-
public
getDescribeDestinationsIterator ( array $args = array() )
The input array uses the parameters of the DescribeDestinations operation
-
public
getDescribeLogGroupsIterator ( array $args = array() )
The input array uses the parameters of the DescribeLogGroups operation
-
public
getDescribeLogStreamsIterator ( array $args = array() )
The input array uses the parameters of the DescribeLogStreams operation
-
public
getDescribeMetricFiltersIterator ( array $args = array() )
The input array uses the parameters of the DescribeMetricFilters operation
-
public
getDescribeSubscriptionFiltersIterator ( array $args = array() )
The input array uses the parameters of the DescribeSubscriptionFilters operation
-
public
getFilterLogEventsIterator ( array $args = array() )
The input array uses the parameters of the FilterLogEvents operation
-
public
getGetLogEventsIterator ( array $args = array() )
The input array uses the parameters of the GetLogEvents operation
Methods detail
Executes the TestMetricFilter operation.
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.
Parameters
- $config
array
$arg Associative array containing the following keys (required keys are bold):-
filterPattern => (string)A symbolic description of how Amazon CloudWatch Logs should interpret the data in each log event. For example, a log event may 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>)A list of log event messages to test.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
matches => (array<associative-array>)- (associative-array)
-
eventNumber => (int) -
eventMessage => (string) -
extractedValues => (associative-array<string>)Associative array of <string> keys mapping to (string) values. Each array key should be changed to an appropriate <string>.
-
<string> => (string)
-
-
- (associative-array)
Overrides
Executes the CancelExportTask operation.
Cancels an export task if it is in
Examples
- Basic formatting example
$result = $client->cancelExportTask(array( // taskId is required 'taskId' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
taskId => (string)Id of the export task to cancel.
-
Returns
Executes the CreateExportTask operation.
Creates an
This is an asynchronous call. If all the required information is provided,
this API will initiate an export task and respond with the task Id. Once
started,
Examples
- Basic formatting example
$result = $client->createExportTask(array( 'taskName' => 'string', // logGroupName is required 'logGroupName' => 'string', 'logStreamNamePrefix' => 'string', // from is required 'from' => integer, // to is required 'to' => integer, // destination is required 'destination' => 'string', 'destinationPrefix' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
taskName => (string)The name of the export task.
-
logGroupName => (string)The name of the log group to export.
-
logStreamNamePrefix => (string)Will only export log streams that match the provided logStreamNamePrefix. If you don't specify a value, no prefix filter is applied.
-
from => (int)A unix timestamp indicating the start time of the range for the request. Events with a timestamp prior to this time will not be exported.
-
to => (int)A unix timestamp indicating the end time of the range for the request. Events with a timestamp later than this time will not be exported.
-
destination => (string)Name of Amazon S3 bucket to which the log data will be exported.
NOTE: Only buckets in the same AWS region are supported -
destinationPrefix => (string)Prefix that will be used as the start of Amazon S3 key for every object exported. If not specified, this defaults to 'exportedlogs'.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
taskId => (string)Id of the export task that got created.
Executes the CreateLogGroup operation.
Creates a new log group with the specified name. The name of the log group must be unique within a region for an AWS account. You can create up to 500 log groups per account.
You must use the following guidelines when naming a log group:
- Log group names can be between 1 and 512 characters long.
- Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period).
Examples
- Basic formatting example
$result = $client->createLogGroup(array( // logGroupName is required 'logGroupName' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group to create.
-
Returns
Executes the CreateLogStream operation.
Creates a new log stream in the specified log group. The name of the log stream must be unique within the log group. There is no limit on the number of log streams that can exist in a log group.
You must use the following guidelines when naming a log stream:
- Log stream names can be between 1 and 512 characters long.
- The ':' colon character is not allowed.
Examples
- Basic formatting example
$result = $client->createLogStream(array( // logGroupName is required 'logGroupName' => 'string', // logStreamName is required 'logStreamName' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group under which the log stream is to be created.
-
logStreamName => (string)The name of the log stream to create.
-
Returns
Executes the DeleteDestination operation.
Deletes the destination with the specified name and eventually disables all the subscription filters that publish to it. This will not delete the physical resource encapsulated by the destination.
Examples
- Basic formatting example
$result = $client->deleteDestination(array( // destinationName is required 'destinationName' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
destinationName => (string)The name of destination to delete.
-
Returns
Executes the DeleteLogGroup operation.
Deletes the log group with the specified name and permanently deletes all the archived log events associated with it.
Examples
- Basic formatting example
$result = $client->deleteLogGroup(array( // logGroupName is required 'logGroupName' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group to delete.
-
Returns
Executes the DeleteLogStream operation.
Deletes a log stream and permanently deletes all the archived log events associated with it.
Examples
- Basic formatting example
$result = $client->deleteLogStream(array( // logGroupName is required 'logGroupName' => 'string', // logStreamName is required 'logStreamName' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group under which the log stream to delete belongs.
-
logStreamName => (string)The name of the log stream to delete.
-
Returns
Executes the DeleteMetricFilter operation.
Deletes a metric filter associated with the specified log group.
Examples
- Basic formatting example
$result = $client->deleteMetricFilter(array( // logGroupName is required 'logGroupName' => 'string', // filterName is required 'filterName' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group that is associated with the metric filter to delete.
-
filterName => (string)The name of the metric filter to delete.
-
Returns
Executes the DeleteRetentionPolicy operation.
Deletes the retention policy of the specified log group. Log events would not expire if they belong to log groups without a retention policy.
Examples
- Basic formatting example
$result = $client->deleteRetentionPolicy(array( // logGroupName is required 'logGroupName' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group that is associated with the retention policy to delete.
-
Returns
Executes the DeleteSubscriptionFilter operation.
Deletes a subscription filter associated with the specified log group.
Examples
- Basic formatting example
$result = $client->deleteSubscriptionFilter(array( // logGroupName is required 'logGroupName' => 'string', // filterName is required 'filterName' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group that is associated with the subscription filter to delete.
-
filterName => (string)The name of the subscription filter to delete.
-
Returns
Executes the DescribeDestinations operation.
Returns all the destinations that are associated with the AWS account making the request. The list returned in the response is ASCII-sorted by destination name.
By default, this operation returns up to 50 destinations. If there are more
destinations to list, the response would contain a nextToken value in the
response body. You can also limit the number of destinations returned in the
response by specifying the
limit parameter in the request.
Examples
- Basic formatting example
$result = $client->describeDestinations(array( 'DestinationNamePrefix' => 'string', 'nextToken' => 'string', 'limit' => integer, ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
DestinationNamePrefix => (string)Will only return destinations that match the provided destinationNamePrefix. If you don't specify a value, no prefix is applied.
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
-
limit => (int)The maximum number of results to return.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
destinations => (array<associative-array>)- (associative-array)
A cross account destination that is the recipient of subscription log events.
-
destinationName => (string)Name of the destination.
-
targetArn => (string)ARN of the physical target where the log events will be delivered (eg. ARN of a Kinesis stream).
-
roleArn => (string)A role for impersonation for delivering log events to the target.
-
accessPolicy => (string)An IAM policy document that governs which AWS accounts can create subscription filters against this destination.
-
arn => (string)ARN of this destination.
-
creationTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC specifying when this destination was created.
-
- (associative-array)
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
Executes the DescribeExportTasks operation.
Returns all the export tasks that are associated with the AWS account making
the request. The export tasks can be filtered based on
By default, this operation returns up to 50 export tasks that satisfy the
specified filters. If there are more export tasks to list, the response would
contain a nextToken value in the response body. You can also limit the
number of export tasks returned in the response by specifying the
limit
parameter in the request.
Examples
- Basic formatting example
$result = $client->describeExportTasks(array( 'taskId' => 'string', 'statusCode' => 'string', 'nextToken' => 'string', 'limit' => integer, ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
taskId => (string)Export task that matches the specified task Id will be returned. This can result in zero or one export task.
-
statusCode => (string:CANCELLED |COMPLETED |FAILED |PENDING |PENDING_CANCEL |RUNNING )All export tasks that matches the specified status code will be returned. This can return zero or more export tasks.
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous
DescribeExportTasks request.
-
limit => (int)The maximum number of items returned in the response. If you don't specify a value, the request would return up to 50 items.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
exportTasks => (array<associative-array>)A list of export tasks.
- (associative-array)
Represents an export task.
-
taskId => (string)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 => (int)A unix timestamp indicating the start time of the range for the request. Events with a timestamp prior to this time were not exported.
-
to => (int)A unix timestamp indicating the end time of the range for the request. Events with a timestamp later than this time were not exported.
-
destination => (string)Name of Amazon S3 bucket to which the log data was exported.
-
destinationPrefix => (string)Prefix that was used as the start of Amazon S3 key for every object exported.
-
status => (associative-array)Status of the export task.
-
code => (string)Status code of the export task.
-
message => (string)Status message related to the
code.
-
-
executionInfo => (associative-array)Execution info about the export task.
-
creationTime => (int)A point in time when the export task got created.
-
completionTime => (int)A point in time when the export task got completed.
-
-
- (associative-array)
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
Executes the DescribeLogGroups operation.
Returns all the log groups that are associated with the AWS account making the request. The list returned in the response is ASCII-sorted by log group name.
By default, this operation returns up to 50 log groups. If there are more log
groups to list, the response would contain a nextToken value in the
response body. You can also limit the number of log groups returned in the
response by specifying the
limit parameter in the request.
Examples
- Basic formatting example
$result = $client->describeLogGroups(array( 'logGroupNamePrefix' => 'string', 'nextToken' => 'string', 'limit' => integer, ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupNamePrefix => (string)Will only return log groups that match the provided logGroupNamePrefix. If you don't specify a value, no prefix filter is applied.
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous
DescribeLogGroups request.
-
limit => (int)The maximum number of items returned in the response. If you don't specify a value, the request would return up to 50 items.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
logGroups => (array<associative-array>)A list of log groups.
- (associative-array)
-
logGroupName => (string) -
creationTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
retentionInDays => (int)Specifies the number of days you want to retain 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, 3653.
-
metricFilterCount => (int)The number of metric filters associated with the log group.
-
arn => (string) -
storedBytes => (int)
-
- (associative-array)
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
Executes the DescribeLogStreams operation.
Returns all the log streams that are associated with the specified log group. The list returned in the response is ASCII-sorted by log stream name.
By default, this operation returns up to 50 log streams. If there are more
log streams to list, the response would contain a nextToken value in the
response body. You can also limit the number of log streams returned in the
response by specifying the
limit parameter in the request. This operation
has a limit of five transactions per second, after which transactions are
throttled.
Examples
- Basic formatting example
$result = $client->describeLogStreams(array( // logGroupName is required 'logGroupName' => 'string', 'logStreamNamePrefix' => 'string', 'orderBy' => 'string', 'descending' => true || false, 'nextToken' => 'string', 'limit' => integer, ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The log group name for which log streams are to be listed.
-
logStreamNamePrefix => (string)Will only return log streams that match the provided logStreamNamePrefix. If you don't specify a value, no prefix filter is applied.
-
orderBy => (string:LogStreamName |LastEventTime )Specifies what to order the returned log streams by. Valid arguments are 'LogStreamName' or 'LastEventTime'. If you don't specify a value, results are ordered by LogStreamName. If 'LastEventTime' is chosen, the request cannot also contain a logStreamNamePrefix.
-
descending => (bool)If set to true, results are returned in descending order. If you don't specify a value or set it to false, results are returned in ascending order.
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous
DescribeLogStreams request.
-
limit => (int)The maximum number of items returned in the response. If you don't specify a value, the request would return up to 50 items.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
logStreams => (array<associative-array>)A list of log streams.
- (associative-array)
A log stream is sequence of log events from a single emitter of logs.
-
logStreamName => (string) -
creationTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
firstEventTimestamp => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
lastEventTimestamp => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
lastIngestionTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
uploadSequenceToken => (string)A string token used for making PutLogEvents requests. A
sequenceToken can only be used once, and PutLogEvents requests must include the
sequenceToken obtained from the response of the previous request.
-
arn => (string) -
storedBytes => (int)
-
- (associative-array)
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
Executes the DescribeMetricFilters operation.
Returns all the metrics filters associated with the specified log group. The list returned in the response is ASCII-sorted by filter name.
By default, this operation returns up to 50 metric filters. If there are more
metric filters to list, the response would contain a nextToken value in
the response body. You can also limit the number of metric filters returned in
the response by specifying the
limit parameter in the request.
Examples
- Basic formatting example
$result = $client->describeMetricFilters(array( // logGroupName is required 'logGroupName' => 'string', 'filterNamePrefix' => 'string', 'nextToken' => 'string', 'limit' => integer, ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The log group name for which metric filters are to be listed.
-
filterNamePrefix => (string)Will only return metric filters that match the provided filterNamePrefix. If you don't specify a value, no prefix filter is applied.
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous
DescribeMetricFilters request.
-
limit => (int)The maximum number of items returned in the response. If you don't specify a value, the request would return up to 50 items.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
metricFilters => (array<associative-array>)- (associative-array)
Metric filters can be used to express how Amazon CloudWatch Logs would extract metric observations from ingested log events and transform them to metric data in a CloudWatch metric.
-
filterName => (string)A name for a metric or subscription filter.
-
filterPattern => (string)A symbolic description of how Amazon CloudWatch Logs should interpret the data in each log event. For example, a log event may 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<associative-array>)- (associative-array)
-
metricName => (string)The name of the CloudWatch metric to which the monitored log information should be published. For example, you may publish to a metric called ErrorCount.
-
metricNamespace => (string)The destination namespace of the new CloudWatch metric.
-
metricValue => (string)What to publish to the metric. For example, if you're counting the occurrences of a particular term like "Error", the value will be "1" for each occurrence. If you're counting the bytes transferred the published value will be the value in the log event.
-
- (associative-array)
-
creationTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
- (associative-array)
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
Executes the DescribeSubscriptionFilters operation.
Returns all the subscription filters associated with the specified log group. The list returned in the response is ASCII-sorted by filter name.
By default, this operation returns up to 50 subscription filters. If there
are more subscription filters to list, the response would contain a
nextToken value in the response body. You can also limit the number of
subscription filters returned in the response by specifying the
limit
parameter in the request.
Examples
- Basic formatting example
$result = $client->describeSubscriptionFilters(array( // logGroupName is required 'logGroupName' => 'string', 'filterNamePrefix' => 'string', 'nextToken' => 'string', 'limit' => integer, ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The log group name for which subscription filters are to be listed.
-
filterNamePrefix => (string)Will only return subscription filters that match the provided filterNamePrefix. If you don't specify a value, no prefix filter is applied.
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
-
limit => (int)The maximum number of results to return.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
subscriptionFilters => (array<associative-array>)- (associative-array)
-
filterName => (string)A name for a metric or subscription filter.
-
logGroupName => (string) -
filterPattern => (string)A symbolic description of how Amazon CloudWatch Logs should interpret the data in each log event. For example, a log event may 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) -
roleArn => (string) -
creationTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
- (associative-array)
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
Executes the FilterLogEvents operation.
Retrieves log events, optionally filtered by a filter pattern from the
specified log group. You can provide an optional time range to filter the
results on the event timestamp. You can limit the streams searched to an
explicit list of
logStreamNames.
By default, this operation returns as much matching log events as can fit in
a response size of 1MB, up to 10,000 log events, or all the events found within
a time-bounded scan window. If the response includes a nextToken, then
there is more data to search, and the search can be resumed with a new request
providing the nextToken. The response will contain a list of
searchedLogStreams that contains information about which streams were
searched in the request and whether they have been searched completely or
require further pagination. The
limit parameter in the request. can be
used to specify the maximum number of events to return in a page.
Examples
- Basic formatting example
$result = $client->filterLogEvents(array( // logGroupName is required 'logGroupName' => 'string', 'logStreamNames' => array('string', ... ), 'startTime' => integer, 'endTime' => integer, 'filterPattern' => 'string', 'nextToken' => 'string', 'limit' => integer, 'interleaved' => true || false, ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group to query.
-
logStreamNames => (array<string>)Optional list of log stream names within the specified log group to search. Defaults to all the log streams in the log group.
-
startTime => (int)A unix timestamp indicating the start time of the range for the request. If provided, events with a timestamp prior to this time will not be returned.
-
endTime => (int)A unix timestamp indicating the end time of the range for the request. If provided, events with a timestamp later than this time will not be returned.
-
filterPattern => (string)A valid CloudWatch Logs filter pattern to use for filtering the response. If not provided, all the events are matched.
-
nextToken => (string)A pagination token obtained from a
FilterLogEvents response to continue paginating the FilterLogEvents results.
-
limit => (int)The maximum number of events to return in a page of results. Default is 10,000 events.
-
interleaved => (bool)If provided, the API will make a best effort to provide responses that contain events from multiple log streams within the log group interleaved in a single response. If not provided, all the matched log events in the first log stream will be searched first, then those in the next log stream, etc.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
events => (array<associative-array>)A list of
FilteredLogEvent objects representing the matched events from the request.
- (associative-array)
Represents a matched event from a
FilterLogEvents request.
-
logStreamName => (string)The name of the log stream this event belongs to.
-
timestamp => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
message => (string)The data contained in the log event.
-
ingestionTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
eventId => (string)A unique identifier for this event.
-
- (associative-array)
-
searchedLogStreams => (array<associative-array>)A list of
SearchedLogStream objects indicating which log streams have been searched in this request and whether each has been searched completely or still has more to be paginated.
- (associative-array)
An object indicating the search status of a log stream in a
FilterLogEvents request.
-
logStreamName => (string)The name of the log stream.
-
searchedCompletely => (bool)Indicates whether all the events in this log stream were searched or more data exists to search by paginating further.
-
- (associative-array)
-
nextToken => (string)A pagination token obtained from a
FilterLogEvents response to continue paginating the FilterLogEvents results.
Executes the GetLogEvents operation.
Retrieves log events from the specified log stream. You can provide an
optional time range to filter the results on the event timestamp.
By default, this operation returns as much log events as can fit in a
response size of 1MB, up to 10,000 log events. The response will always include
a nextForwardToken and a
nextBackwardToken in the response body. You
can use any of these tokens in subsequent
GetLogEvents requests to
paginate through events in either forward or backward direction. You can also
limit the number of log events returned in the response by specifying the
limit parameter in the request.
Examples
- Basic formatting example
$result = $client->getLogEvents(array( // logGroupName is required 'logGroupName' => 'string', // logStreamName is required 'logStreamName' => 'string', 'startTime' => integer, 'endTime' => integer, 'nextToken' => 'string', 'limit' => integer, 'startFromHead' => true || false, ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group to query.
-
logStreamName => (string)The name of the log stream to query.
-
startTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
endTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
nextToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the
nextForwardToken or
nextBackwardToken fields in the response of the previous
GetLogEvents request.
-
limit => (int)The maximum number of log events returned in the response. If you don't specify a value, the request would return as many log events as can fit in a response size of 1MB, up to 10,000 log events.
-
startFromHead => (bool)If set to true, the earliest log events would be returned first. The default is false (the latest log events are returned first).
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
events => (array<associative-array>)- (associative-array)
-
timestamp => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
message => (string) -
ingestionTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
- (associative-array)
-
nextForwardToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
-
nextBackwardToken => (string)A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.
Executes the PutDestination operation.
Creates or updates a
PutLogEvents requests. Currently, the only
supported physical resource is a Amazon Kinesis stream belonging to the same
account as the destination.
A destination controls what is written to its Amazon Kinesis stream through
an access policy. By default, PutDestination does not set any access policy with
the destination, which means a cross-account user will not be able to call
Examples
- Basic formatting example
$result = $client->putDestination(array( // destinationName is required 'destinationName' => 'string', // targetArn is required 'targetArn' => 'string', // roleArn is required 'roleArn' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
destinationName => (string)A name for the destination.
-
targetArn => (string)The ARN of an Amazon Kinesis stream to deliver matching log events to.
-
roleArn => (string)The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to do Amazon Kinesis PutRecord requests on the desitnation stream.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
destination => (associative-array)A cross account destination that is the recipient of subscription log events.
-
destinationName => (string)Name of the destination.
-
targetArn => (string)ARN of the physical target where the log events will be delivered (eg. ARN of a Kinesis stream).
-
roleArn => (string)A role for impersonation for delivering log events to the target.
-
accessPolicy => (string)An IAM policy document that governs which AWS accounts can create subscription filters against this destination.
-
arn => (string)ARN of this destination.
-
creationTime => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC specifying when this destination was created.
-
Executes the PutDestinationPolicy operation.
Creates or updates an access policy associated with an existing
Examples
- Basic formatting example
$result = $client->putDestinationPolicy(array( // destinationName is required 'destinationName' => 'string', // accessPolicy is required 'accessPolicy' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
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 associated destination.
-
Returns
Executes the PutLogEvents operation.
Uploads a batch of log events to the specified log stream.
Every PutLogEvents request must include the sequenceToken obtained from
the response of the previous request. An upload in a newly created log stream
does not require a
sequenceToken.
The batch of events must satisfy the following constraints:
- The maximum batch size is 1,048,576 bytes, and 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 the retention period of the log group.
- The log events in the batch must be in chronological ordered by their
timestamp.
- The maximum number of log events in a batch is 10,000.
Examples
- Basic formatting example
$result = $client->putLogEvents(array( // logGroupName is required 'logGroupName' => 'string', // logStreamName is required 'logStreamName' => 'string', // logEvents is required 'logEvents' => array( array( // timestamp is required 'timestamp' => integer, // message is required 'message' => 'string', ), // ... repeated ), 'sequenceToken' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group to put log events to.
-
logStreamName => (string)The name of the log stream to put log events to.
-
logEvents => (array<associative-array>)A list of log events belonging to a log stream.
- (associative-array)
A log event is a record of some activity that was recorded by the application or resource being monitored. The log event record that Amazon CloudWatch Logs understands contains two properties: the timestamp of when the event occurred, and the raw event message.
-
timestamp => (int)A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.
-
message => (string)
-
- (associative-array)
-
sequenceToken => (string)A string token that must be obtained from the response of the previous
PutLogEvents request.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
nextSequenceToken => (string)A string token used for making PutLogEvents requests. A
sequenceToken can only be used once, and PutLogEvents requests must include the
sequenceToken obtained from the response of the previous request.
-
rejectedLogEventsInfo => (associative-array)-
tooNewLogEventStartIndex => (int) -
tooOldLogEventEndIndex => (int) -
expiredLogEventEndIndex => (int)
-
Executes the PutMetricFilter operation.
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 requests.
The maximum number of metric filters that can be associated with a log group is 100.
Examples
- Basic formatting example
$result = $client->putMetricFilter(array( // logGroupName is required 'logGroupName' => 'string', // filterName is required 'filterName' => 'string', // filterPattern is required 'filterPattern' => 'string', // metricTransformations is required 'metricTransformations' => array( array( // metricName is required 'metricName' => 'string', // metricNamespace is required 'metricNamespace' => 'string', // metricValue is required 'metricValue' => 'string', ), // ... repeated ), ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group to associate the metric filter with.
-
filterName => (string)A name for the metric filter.
-
filterPattern => (string)A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.
-
metricTransformations => (array<associative-array>)A collection of information needed to define how metric data gets emitted.
- (associative-array)
-
metricName => (string)The name of the CloudWatch metric to which the monitored log information should be published. For example, you may publish to a metric called ErrorCount.
-
metricNamespace => (string)The destination namespace of the new CloudWatch metric.
-
metricValue => (string)What to publish to the metric. For example, if you're counting the occurrences of a particular term like "Error", the value will be "1" for each occurrence. If you're counting the bytes transferred the published value will be the value in the log event.
-
- (associative-array)
-
Returns
Executes the PutRetentionPolicy operation.
Sets the retention of the specified log group. A retention policy allows you to configure the number of days you want to retain log events in the specified log group.
Examples
- Basic formatting example
$result = $client->putRetentionPolicy(array( // logGroupName is required 'logGroupName' => 'string', // retentionInDays is required 'retentionInDays' => integer, ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group to associate the retention policy with.
-
retentionInDays => (int)Specifies the number of days you want to retain 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, 3653.
-
Returns
Executes the PutSubscriptionFilter operation.
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 requests and have them delivered
to a specific destination. Currently, the supported destinations are:
- A Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.
- A logical destination (used via an ARN of
Destination ) belonging to a different account, for cross-account delivery.
Currently there can only be one subscription filter associated with a log group.
Examples
- Basic formatting example
$result = $client->putSubscriptionFilter(array( // logGroupName is required 'logGroupName' => 'string', // filterName is required 'filterName' => 'string', // filterPattern is required 'filterPattern' => 'string', // destinationArn is required 'destinationArn' => 'string', 'roleArn' => 'string', ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
logGroupName => (string)The name of the log group to associate the subscription filter with.
-
filterName => (string)A name for the subscription filter.
-
filterPattern => (string)A valid CloudWatch Logs 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:
- A Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.
- A logical destination (used via an ARN of Destination) belonging to a different account, for cross-account delivery.
-
roleArn => (string)The ARN of an IAM role that grants Amazon 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 (used via an ARN of Destination) for cross-account delivery.
-
Returns
Executes the TestMetricFilter operation.
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.
Examples
- Basic formatting example
$result = $client->testMetricFilter(array( // filterPattern is required 'filterPattern' => 'string', // logEventMessages is required 'logEventMessages' => array('string', ... ), ));
Parameters
- $args
array
$arg Associative array containing the following keys (required keys are bold):-
filterPattern => (string)A symbolic description of how Amazon CloudWatch Logs should interpret the data in each log event. For example, a log event may 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>)A list of log event messages to test.
-
Returns
Guzzle\Service\Resource\Model
Returns a response Model object
-
matches => (array<associative-array>)- (associative-array)
-
eventNumber => (int) -
eventMessage => (string) -
extractedValues => (associative-array<string>)Associative array of <string> keys mapping to (string) values. Each array key should be changed to an appropriate <string>.
-
<string> => (string)
-
-
- (associative-array)
The input array uses the parameters of the DescribeDestinations operation
Parameters
- $args
array
$args
Returns
ResourceIteratorInterface
The input array uses the parameters of the DescribeLogGroups operation
Parameters
- $args
array
$args
Returns
ResourceIteratorInterface
The input array uses the parameters of the DescribeLogStreams operation
Parameters
- $args
array
$args
Returns
ResourceIteratorInterface
The input array uses the parameters of the DescribeMetricFilters operation
Parameters
- $args
array
$args
Returns
ResourceIteratorInterface
The input array uses the parameters of the DescribeSubscriptionFilters operation
Parameters
- $args
array
$args
Returns
ResourceIteratorInterface
The input array uses the parameters of the FilterLogEvents operation
Parameters
- $args
array
$args
Returns
ResourceIteratorInterface
The input array uses the parameters of the GetLogEvents operation
Parameters
- $args
array
$args
Returns
ResourceIteratorInterface
Methods inherited from Aws\Common\Client\AbstractClient
__call()
,
__construct()
,
createRequest()
,
getAllEvents()
,
getApiVersion()
,
getCredentials()
,
getRegion()
,
getRegions()
,
getSignature()
,
getWaiter()
,
getWaiterFactory()
,
send()
,
setCredentials()
,
setRegion()
,
setWaiterFactory()
,
waitUntil()
Methods inherited from Guzzle\Service\Client
execute()
,
executeMultiple()
,
getCommand()
,
getCommandFactory()
,
getDescription()
,
getInflector()
,
getIterator()
,
getResourceIteratorFactory()
,
prepareCommand()
,
setCommandFactory()
,
setDescription()
,
setInflector()
,
setResourceIteratorFactory()
Methods inherited from Guzzle\Http\Client
delete()
,
expandTemplate()
,
extractPharCacert()
,
get()
,
getBaseUrl()
,
getConfig()
,
getCurlMulti()
,
getDefaultOption()
,
getDefaultUserAgent()
,
getUriTemplate()
,
head()
,
initSsl()
,
options()
,
patch()
,
post()
,
prepareRequest()
,
put()
,
sendMultiple()
,
setBaseUrl()
,
setConfig()
,
setCurlMulti()
,
setDefaultOption()
,
setRequestFactory()
,
setSslVerification()
,
setUriTemplate()
,
setUserAgent()
Methods inherited from Guzzle\Common\AbstractHasDispatcher
addSubscriber()
,
dispatch()
,
getEventDispatcher()
,
setEventDispatcher()
Magic methods summary
Constants summary
string |
LATEST_API_VERSION |
'2014-03-28' |
Constants inherited from Guzzle\Service\Client
Constants inherited from Guzzle\Http\Client
CURL_OPTIONS
,
DEFAULT_SELECT_TIMEOUT
,
DISABLE_REDIRECTS
,
MAX_HANDLES
,
REQUEST_OPTIONS
,
SSL_CERT_AUTHORITY
Constants inherited from Guzzle\Http\ClientInterface
Properties summary
Properties inherited from Aws\Common\Client\AbstractClient
$aggregator
,
$credentials
,
$signature
,
$waiterFactory
Properties inherited from Guzzle\Service\Client
$commandFactory
,
$inflector
,
$resourceIteratorFactory
,
$serviceDescription
Properties inherited from Guzzle\Http\Client
$defaultHeaders
,
$requestFactory
,
$userAgent