Thursday, October 27, 2022

[SOLVED] Is it possible to arrange log group in a logical directory structure in AWS CloudWatch?

Issue

I have several EC2 instances (Windows servers) which include several applications with quite amount of log files in each. Is it possible to push logs so that they would be arranged in the form of logical directory structure in the CloudWatch? (like shown below):

general_log_group_name 
  /instance_#1
     /file_path/logs
        /xxxx.log
        /xxxx.log
  /instance_#2
     /file_path/logs
        /xxxx.log
        /xxxx.log
 etc ... 

I've searched internet, tried to experiment, couldn't find a way, I am newbie to the AWS services, still in the learning process, thought maybe somebody with more experience in the field or with a fresh view could help, any help would be appreciated.

Thanks, Cheers!


Solution

The structure you propose is not possible because a log stream has no subcomponents.

I would recommend the following structure:

general_log_group_name 
  /instance_#1_log_a
      /xxxx.log
  /instance_#1_log_b
      /xxxx.log
  /instance_#2_log_a
      /xxxx.log
  /instance_#2_log_b
      /xxxx.log


Answered By - Paolo
Answer Checked By - Pedro (WPSolving Volunteer)