awslogs icon indicating copy to clipboard operation
awslogs copied to clipboard

Changing the format of the logs

Open fersarr opened this issue 3 years ago • 2 comments

Hi! Thanks for this package! I was looking around and couldn't find a way to change the format of the logs but I thought you probably have a way to do that? For example, how can I remove the logstream name or the timestamp from the logs?

Example:

2022-11-03T16:01:04.010000+00:00 2022/11/03/[$LATEST]58asd312e7212131223124ae149 [INFO]    2022-11-03T16:01:04.010Z        70sadasbd-xxasaa9-5b70-a2ea-6860xasdasdas637ee5    Hey this is an actual log

I just want the part Hey this is an actual log

Thanks!

fersarr avatar Nov 03 '22 15:11 fersarr

Hi! What is the exact command and arguments that you're trying?

As the help of the command shows, you can control some information in the output:

$ awslogs get --help
[...]
  -G, --no-group        Do not display group name
  -S, --no-stream       Do not display stream name
  --timestamp           Add creation timestamp to the output
  --ingestion-time      Add ingestion time to the output
[...]

Also, you can use a CloudWatch Logs Filter pattern.

tovask avatar Nov 22 '22 06:11 tovask

Hi! Thanks for the help. I thank that will definitely improve it. I was looking for something like the usual --format "...." where you can specify everything, like the format of the date and everything else. But that will certainly help. Thanks!

fersarr avatar Nov 22 '22 09:11 fersarr