Amazon CloudWatch Logs

2018/09/07 - Amazon CloudWatch Logs - 1 updated api methods

Changes  * Adding a log prefix parameter for filter log events API and minor updates to the documentation

FilterLogEvents (updated) Link ΒΆ
Changes (request)
{'logStreamNamePrefix': 'string'}

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.

See also: AWS API Documentation

Request Syntax

client.filter_log_events(
    logGroupName='string',
    logStreamNames=[
        'string',
    ],
    logStreamNamePrefix='string',
    startTime=123,
    endTime=123,
    filterPattern='string',
    nextToken='string',
    limit=123,
    interleaved=True|False
)
type logGroupName

string

param logGroupName

[REQUIRED]

The name of the log group to search.

type logStreamNames

list

param logStreamNames

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

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.

  • (string) --

type logStreamNamePrefix

string

param logStreamNamePrefix

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.

type startTime

integer

param startTime

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

type endTime

integer

param endTime

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

type filterPattern

string

param filterPattern

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

If not provided, all the events are matched.

type nextToken

string

param nextToken

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

type limit

integer

param limit

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

type interleaved

boolean

param interleaved

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.

rtype

dict

returns

Response Syntax

{
    'events': [
        {
            'logStreamName': 'string',
            'timestamp': 123,
            'message': 'string',
            'ingestionTime': 123,
            'eventId': 'string'
        },
    ],
    'searchedLogStreams': [
        {
            'logStreamName': 'string',
            'searchedCompletely': True|False
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • events (list) --

      The matched events.

      • (dict) --

        Represents a matched event.

        • logStreamName (string) --

          The name of the log stream this event belongs to.

        • 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 (list) --

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

      • (dict) --

        Represents the search status of a log stream.

        • 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.