I don't think you can do it directly with one metric filter. You could do something like this:
1. Extract MemorySize and MaxMemoryUsed into 2 separate metrics
Create 2 metric filters, both with the same rule [type=REPORT, ...].
This will filter out lines that start with REPORT and it will create variables for each column of the line. In this case, it will create variables $type, $2, $3, ... up to $19 (there are 19 space-separated words in the logline).
Values you need are in variables $13 and $18, so when creating the 2 metric filters, use $13 for the first metric and $18 for the second metric in the Metric value field. Metric names and namespace can be whatever you want. I'll use MemorySize and MaxMemoryUsed for names and CustomLambdaMetrics as the namespace.
2. Use metric math to calculate the value you need.
Now that you have the 2 metrics, you can create a widget with a source like this to get the average usage (region may be different in your case):
{
"metrics": [
[ { "expression": "m2/m1", "label": "Average memory usage", "id": "e1" } ],
[ "CustomLambdaMetrics", "MemorySize", { "id": "m1", "visible": false } ],
[ ".", "MaxMemoryUsed", { "id": "m2", "visible": false } ]
],
"view": "timeSeries",
"stacked": false,
"region": "us-east-1",
"stat": "Sum",
"period": 60
}
See here for more info on metric math: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html