1
votes

aws support Centralized logs for server , we can send custom logs to cloudwatch logs mu awslogs.conf file code is

datetime_format = %d/%b/%Y:%H:%M:%S
file = /path/to/log/file/test.log
buffer_duration = 5000
log_stream_name = test
initial_position = start_of_file
log_group_name = server1

It creates a log file in aws cloudwatch log named test in server1 group

But my custom log file name is current date for example filename = test-2018-03-15.log

I tried the following code

datetime_format = %d/%b/%Y:%H:%M:%S
file = /path/to/log/file/test-%Y-%m-%d.log
buffer_duration = 5000
log_stream_name = test-%Y
initial_position = start_of_file
log_group_name = server1

It doesn't work

and also i tried in file path file = /path/to/log/file/test-{%Y-%m-%d}.log

it also doesn't work

How to upload log files which have current date in their filename to aws cloudwatch using cloudwatch log agent

1

1 Answers

1
votes

You can use a * character as a wildcard. E.g.

file = /path/to/log/file/test-*.log