Skip to content
GitHubXDiscord

LogStream

The LogStream resource allows you to manage AWS Logs LogStreams which are used to collect log events from your applications and services. LogStreams are associated with a LogGroup and are crucial for organizing and processing log data.

Create a basic LogStream associated with a LogGroup.

import AWS from "alchemy/aws/control";
const basicLogStream = await AWS.Logs.LogStream("basicLogStream", {
LogGroupName: "ApplicationLogs",
LogStreamName: "InitialLogStream" // Optional: Default name
});

Configure a LogStream with adoption of an existing resource.

const adoptedLogStream = await AWS.Logs.LogStream("adoptedLogStream", {
LogGroupName: "ApplicationLogs",
LogStreamName: "ExistingLogStream", // Optional: Adopt an existing log stream
adopt: true // Set to true to adopt an existing resource
});

Create a new LogStream for a different service within the same LogGroup.

const serviceLogStream = await AWS.Logs.LogStream("serviceLogStream", {
LogGroupName: "ApplicationLogs",
LogStreamName: "ServiceLogStream" // Optional: Name for new service log stream
});

Update the LogStream name for better identification.

const updatedLogStream = await AWS.Logs.LogStream("updatedLogStream", {
LogGroupName: "ApplicationLogs",
LogStreamName: "UpdatedLogStreamName" // Changing the name for clarity
});