Example usage for com.amazonaws.services.logs.model SubscriptionFilter getFilterName

List of usage examples for com.amazonaws.services.logs.model SubscriptionFilter getFilterName

Introduction

In this page you can find the example usage for com.amazonaws.services.logs.model SubscriptionFilter getFilterName.

Prototype


public String getFilterName() 

Source Link

Document

The name of the subscription filter.

Usage

From source file:aws.example.cloudwatch.DescribeSubscriptionFilters.java

License:Open Source License

public static void main(String[] args) {

    final String USAGE = "To run this example, supply a log group name\n"
            + "Ex: DescribeSubscriptionFilters <log-group-name>\n";

    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);/*from w  w w  . j av a2 s.  c  o m*/
    }

    String log_group = args[0];

    final AWSLogs logs = AWSLogsClientBuilder.defaultClient();
    boolean done = false;

    while (!done) {
        DescribeSubscriptionFiltersRequest request = new DescribeSubscriptionFiltersRequest()
                .withLogGroupName(log_group).withLimit(1);

        DescribeSubscriptionFiltersResult response = logs.describeSubscriptionFilters(request);

        for (SubscriptionFilter filter : response.getSubscriptionFilters()) {
            System.out.printf("Retrieved filter with name %s, " + "pattern %s " + "and destination arn %s",
                    filter.getFilterName(), filter.getFilterPattern(), filter.getDestinationArn());
        }

        request.setNextToken(response.getNextToken());

        if (response.getNextToken() == null) {
            done = true;
        }
    }
}

From source file:cloudwatch.src.main.java.aws.example.cloudwatch.DescribeSubscriptionFilters.java

License:Open Source License

public static void main(String[] args) {

    final String USAGE = "To run this example, supply a log group name\n"
            + "Ex: DescribeSubscriptionFilters <log-group-name>\n";

    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);/* w ww  . j  a v a 2s .  co  m*/
    }

    String logGroupName = args[0];

    final AWSLogs cloudWatchLogs = AWSLogsClientBuilder.defaultClient();

    boolean done = false;

    while (!done) {
        DescribeSubscriptionFiltersRequest request = new DescribeSubscriptionFiltersRequest()
                .withLogGroupName(logGroupName).withLimit(1);

        DescribeSubscriptionFiltersResult response = cloudWatchLogs.describeSubscriptionFilters(request);

        for (SubscriptionFilter filter : response.getSubscriptionFilters()) {
            System.out.printf("Retrieved filter with name %s, pattern %s and destination arn %s",
                    filter.getFilterName(), filter.getFilterPattern(), filter.getDestinationArn());
        }

        request.setNextToken(response.getNextToken());

        if (response.getNextToken() == null) {
            done = true;
        }
    }
}