View a markdown version of this page

expand - Amazon CloudWatch Logs
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

expand

Use expand to take a field containing a JSON array and create a separate log event for each element in the array. All other fields from the original log event are duplicated in each new event.

Syntax

expand fieldName

Example

If a log event contains items = ["apple","banana","cherry"] and host = "web-01", then expand items produces three log events: {items: "apple", host: "web-01"}, {items: "banana", host: "web-01"}, and {items: "cherry", host: "web-01"}.

expand items | stats count(*) by items, host