Jump to Content

This API Documentation is now deprecated

We are excited to announce our new API Documentation.

Class GetLogGroupFieldsCommandProtected

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

You can specify the log group to search by using either logGroupIdentifier or logGroupName. You must specify one of these parameters, but you can't specify both.

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.

If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view data from the linked source accounts. For more information, see CloudWatch cross-account observability.

Example

Use a bare-bones client and the command you need to make an API call.

import { CloudWatchLogsClient, GetLogGroupFieldsCommand } from "@aws-sdk/client-cloudwatch-logs"; // ES Modules import
// const { CloudWatchLogsClient, GetLogGroupFieldsCommand } = require("@aws-sdk/client-cloudwatch-logs"); // CommonJS import
const client = new CloudWatchLogsClient(config);
const input = { // GetLogGroupFieldsRequest
logGroupName: "STRING_VALUE",
time: Number("long"),
logGroupIdentifier: "STRING_VALUE",
};
const command = new GetLogGroupFieldsCommand(input);
const response = await client.send(command);
// { // GetLogGroupFieldsResponse
// logGroupFields: [ // LogGroupFieldList
// { // LogGroupField
// name: "STRING_VALUE",
// percent: Number("int"),
// },
// ],
// };

Param

GetLogGroupFieldsCommandInput

Returns

GetLogGroupFieldsCommandOutput

See

Throws

InvalidParameterException (client fault)

A parameter is specified incorrectly.

Throws

LimitExceededException (client fault)

You have reached the maximum number of resources that can be created.

Throws

ResourceNotFoundException (client fault)

The specified resource does not exist.

Throws

ServiceUnavailableException (server fault)

The service cannot complete the request.

Throws

CloudWatchLogsServiceException

Base exception class for all service exceptions from CloudWatchLogs service.

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

Methods