Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a Log Group and a Log Stream?

I'm trying to setup Amazon Cloud Watch as a remote logging destination for some C# applications I am working on. One thing that is not clear to me is the difference between a Log Group and a Log Stream and how they should be used?

I have a number of small applications which many different users will be running on many computers. So I would like to be able to easily identify the source application, and machine for each log message.

My understanding is a Log Stream is a "sequence of log events that share the same source", so it seems like I would want to create a new Log Stream for each machine or each user per machine. Does this sound right?

like image 737
Eric Anastas Avatar asked Aug 20 '14 18:08

Eric Anastas


People also ask

What is AWS log stream?

A log stream represents the sequence of events coming from an application instance or resource that you are monitoring. There is no limit on the number of log streams that you can create for a log group.

What is the log group of CloudTrail?

CloudTrail uses a CloudWatch Logs log group as a delivery endpoint for log events. You can create a log group or specify an existing one. Make sure you are logged in with an administrative IAM user or role with sufficient permissions to configure CloudWatch Logs integration.

What is log group in AWS console?

The AWS::Logs::LogGroup resource specifies a log group. A log group defines common properties for log streams, such as their retention and access control rules. Each log stream must belong to one log group. You can create up to 1,000,000 log groups per Region per account.

What is a lambda log stream?

The log stream contains messages from that execution environment and also any output from your Lambda function's code. Every message is timestamped, including your custom logs, which means you do not need to output timestamps.


1 Answers

It all depends on the level of aggregation that you want:

  • if you define instance as a source and set instance_id for the name of the stream, then you will have separate log streams for your instances.
  • If you define your application as a source and set e.g. "MyApp" as the name of the stream then all the instances that are running your application will send log events to the same stream. You will be able to handle application log events together, generate metrics and create alarms on those etc.
like image 97
tpolyak Avatar answered Nov 15 '22 21:11

tpolyak