/AWS1/IF_CWL=>TESTMETRICFILTER()¶
About TestMetricFilter¶
Tests the filter pattern of a metric filter against a sample of log event messages. You can use this operation to validate the correctness of a metric filter pattern.
Method Signature¶
METHODS /AWS1/IF_CWL~TESTMETRICFILTER
IMPORTING
!IV_FILTERPATTERN TYPE /AWS1/CWLFILTERPATTERN OPTIONAL
!IT_LOGEVENTMESSAGES TYPE /AWS1/CL_CWLTESTEVENTMSGS_W=>TT_TESTEVENTMESSAGES OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_cwltestmetricfiltrsp
RAISING
/AWS1/CX_CWLINVALIDPARAMETEREX
/AWS1/CX_CWLSERVICEUNAVAILEX
/AWS1/CX_CWLCLIENTEXC
/AWS1/CX_CWLSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_filterpattern TYPE /AWS1/CWLFILTERPATTERN /AWS1/CWLFILTERPATTERN¶
A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.
it_logeventmessages TYPE /AWS1/CL_CWLTESTEVENTMSGS_W=>TT_TESTEVENTMESSAGES TT_TESTEVENTMESSAGES¶
The log event messages to test.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_cwltestmetricfiltrsp /AWS1/CL_CWLTESTMETRICFILTRSP¶
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->testmetricfilter(
it_logeventmessages = VALUE /aws1/cl_cwltesteventmsgs_w=>tt_testeventmessages(
( new /aws1/cl_cwltesteventmsgs_w( |string| ) )
)
iv_filterpattern = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
LOOP AT lo_result->get_matches( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_eventnumber = lo_row_1->get_eventnumber( ).
lv_eventmessage = lo_row_1->get_eventmessage( ).
LOOP AT lo_row_1->get_extractedvalues( ) into ls_row_2.
lv_key = ls_row_2-key.
lo_value = ls_row_2-value.
IF lo_value IS NOT INITIAL.
lv_value_1 = lo_value->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.