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.
This operation is used for discovering fields within log group events. For discovering fields across data sources, use the GetLogFields operation.
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.
Parameters:
-
log_group_name
(Optional[LogGroupName], default:
None
)
–
The name of the log group to search.
You must include either logGroupIdentifier or logGroupName, but not both.
-
time
(Optional[Timestamp], default:
None
)
–
The time to set as the center of the query. If you specify time, the 8 minutes before and 8 minutes after this time are searched. If you omit time, the most recent 15 minutes up to the current time are searched.
The time value is specified as epoch time, which is the number of seconds since January 1, 1970, 00:00:00 UTC.
-
log_group_identifier
(Optional[LogGroupIdentifier], default:
None
)
–
Specify either the name or ARN of the log group to view. If the log group is in a source account and you are using a monitoring account, you must specify the ARN.
You must include either logGroupIdentifier or logGroupName, but not both.
Raises:
Source code in docs_src/capo_cloudwatch_logs/_services/async_cloud_watch_logs.py
| async def get_log_group_fields(
self,
*,
config_overrides: Optional[AsyncCloudWatchLogsClientConfig] = None,
log_group_name: Optional[
"capo_cloudwatch_logs.types.log_group_name.LogGroupName"
] = None,
time: Optional["capo_cloudwatch_logs.types.timestamp.Timestamp"] = None,
log_group_identifier: Optional[
"capo_cloudwatch_logs.types.log_group_identifier.LogGroupIdentifier"
] = None,
) -> "capo_cloudwatch_logs.types.get_log_group_fields_response.GetLogGroupFieldsResponse":
"""<p>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.</p> <p>This operation is used for discovering fields within log group events. For discovering fields across data sources, use the GetLogFields operation.</p> <p>You can specify the log group to search by using either <code>logGroupIdentifier</code> or <code>logGroupName</code>. You must specify one of these parameters, but you can't specify both. </p> <p>In the results, fields that start with <code>@</code> are fields generated by CloudWatch Logs. For example, <code>@timestamp</code> is the timestamp of each log event. For more information about the fields that are generated by CloudWatch logs, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData-discoverable-fields.html">Supported Logs and Discovered Fields</a>.</p> <p>The response results are sorted by the frequency percentage, starting with the highest percentage.</p> <p>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 <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html">CloudWatch cross-account observability</a>.</p>
Args:
log_group_name: <p>The name of the log group to search.</p> <note> <p> You must include either <code>logGroupIdentifier</code> or <code>logGroupName</code>, but not both. </p> </note>
time: <p>The time to set as the center of the query. If you specify <code>time</code>, the 8 minutes before and 8 minutes after this time are searched. If you omit <code>time</code>, the most recent 15 minutes up to the current time are searched.</p> <p>The <code>time</code> value is specified as epoch time, which is the number of seconds since <code>January 1, 1970, 00:00:00 UTC</code>.</p>
log_group_identifier: <p>Specify either the name or ARN of the log group to view. If the log group is in a source account and you are using a monitoring account, you must specify the ARN.</p> <note> <p> You must include either <code>logGroupIdentifier</code> or <code>logGroupName</code>, but not both. </p> </note>
Raises:
capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
capo_cloudwatch_logs.errors.limit_exceeded_exception.LimitExceededException: <p>You have reached the maximum number of resources that can be created.</p>
capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_cloudwatch_logs.types.get_log_group_fields_request.GetLogGroupFieldsRequest]",
) -> AsyncOperationResponse[
"capo_cloudwatch_logs.types.get_log_group_fields_response.GetLogGroupFieldsResponse"
]:
import capo_cloudwatch_logs._operations.logs_20140328.get_log_group_fields
(
output,
http_response,
) = await capo_cloudwatch_logs._operations.logs_20140328.get_log_group_fields.async_get_log_group_fields(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetLogGroupFields")
)
input_: capo_cloudwatch_logs.types.get_log_group_fields_request.GetLogGroupFieldsRequest = {}
if log_group_name is not None:
input_["log_group_name"] = log_group_name
if time is not None:
input_["time"] = time
if log_group_identifier is not None:
input_["log_group_identifier"] = log_group_identifier
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|