How to parse mixed text and JSON log entries in AWS CloudWatch for Log Metric Filter

后端 未结 3 1368
滥情空心
滥情空心 2021-02-18 19:08

I am trying to parse log entries which are a mix of text and JSON. The first line is text representation and the next lines are JSON payload of the event. One of the possible ex

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-18 19:47

    You can use CloudWatch Events for such purpose(aka Subscription Filters), what you will need to do is define a cloudwatch Rule which uses an expression statement to match your logs. Here, I will let you do all the reading:

    https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html

    https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/Create-CloudWatch-Events-Scheduled-Rule.html

    :)

提交回复
热议问题