1. Packages
  2. AWS
  3. API Docs
  4. cloudwatch
  5. getLogGroups
AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi

aws.cloudwatch.getLogGroups

Explore with Pulumi AI

AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi

Use this data source to get a list of AWS Cloudwatch Log Groups

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.cloudwatch.getLogGroups({
    logGroupNamePrefix: "/MyImportantLogs",
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.cloudwatch.get_log_groups(log_group_name_prefix="/MyImportantLogs")
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudwatch.GetLogGroups(ctx, &cloudwatch.GetLogGroupsArgs{
			LogGroupNamePrefix: pulumi.StringRef("/MyImportantLogs"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.CloudWatch.GetLogGroups.Invoke(new()
    {
        LogGroupNamePrefix = "/MyImportantLogs",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.CloudwatchFunctions;
import com.pulumi.aws.cloudwatch.inputs.GetLogGroupsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var example = CloudwatchFunctions.getLogGroups(GetLogGroupsArgs.builder()
            .logGroupNamePrefix("/MyImportantLogs")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:cloudwatch:getLogGroups
      arguments:
        logGroupNamePrefix: /MyImportantLogs
Copy

Using getLogGroups

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getLogGroups(args: GetLogGroupsArgs, opts?: InvokeOptions): Promise<GetLogGroupsResult>
function getLogGroupsOutput(args: GetLogGroupsOutputArgs, opts?: InvokeOptions): Output<GetLogGroupsResult>
Copy
def get_log_groups(log_group_name_prefix: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetLogGroupsResult
def get_log_groups_output(log_group_name_prefix: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetLogGroupsResult]
Copy
func GetLogGroups(ctx *Context, args *GetLogGroupsArgs, opts ...InvokeOption) (*GetLogGroupsResult, error)
func GetLogGroupsOutput(ctx *Context, args *GetLogGroupsOutputArgs, opts ...InvokeOption) GetLogGroupsResultOutput
Copy

> Note: This function is named GetLogGroups in the Go SDK.

public static class GetLogGroups 
{
    public static Task<GetLogGroupsResult> InvokeAsync(GetLogGroupsArgs args, InvokeOptions? opts = null)
    public static Output<GetLogGroupsResult> Invoke(GetLogGroupsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetLogGroupsResult> getLogGroups(GetLogGroupsArgs args, InvokeOptions options)
public static Output<GetLogGroupsResult> getLogGroups(GetLogGroupsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:cloudwatch/getLogGroups:getLogGroups
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

LogGroupNamePrefix string
Group prefix of the Cloudwatch log groups to list
LogGroupNamePrefix string
Group prefix of the Cloudwatch log groups to list
logGroupNamePrefix String
Group prefix of the Cloudwatch log groups to list
logGroupNamePrefix string
Group prefix of the Cloudwatch log groups to list
log_group_name_prefix str
Group prefix of the Cloudwatch log groups to list
logGroupNamePrefix String
Group prefix of the Cloudwatch log groups to list

getLogGroups Result

The following output properties are available:

Arns List<string>
Set of ARNs of the Cloudwatch log groups
Id string
The provider-assigned unique ID for this managed resource.
LogGroupNames List<string>
Set of names of the Cloudwatch log groups
LogGroupNamePrefix string
Arns []string
Set of ARNs of the Cloudwatch log groups
Id string
The provider-assigned unique ID for this managed resource.
LogGroupNames []string
Set of names of the Cloudwatch log groups
LogGroupNamePrefix string
arns List<String>
Set of ARNs of the Cloudwatch log groups
id String
The provider-assigned unique ID for this managed resource.
logGroupNames List<String>
Set of names of the Cloudwatch log groups
logGroupNamePrefix String
arns string[]
Set of ARNs of the Cloudwatch log groups
id string
The provider-assigned unique ID for this managed resource.
logGroupNames string[]
Set of names of the Cloudwatch log groups
logGroupNamePrefix string
arns Sequence[str]
Set of ARNs of the Cloudwatch log groups
id str
The provider-assigned unique ID for this managed resource.
log_group_names Sequence[str]
Set of names of the Cloudwatch log groups
log_group_name_prefix str
arns List<String>
Set of ARNs of the Cloudwatch log groups
id String
The provider-assigned unique ID for this managed resource.
logGroupNames List<String>
Set of names of the Cloudwatch log groups
logGroupNamePrefix String

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.
AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi