

# Amazon ECS 的 Amazon for Fluent Bit 映像存储库
<a name="firelens-using-fluentbit"></a>

Amazon 提供了 Fluent Bit 映像以及 CloudWatch Logs 和 Firehose 的插件。我们建议使用 Fluent Bit 作为日志路由器，因为其资源利用率低于 Fluentd。有关更多信息，请参阅 [CloudWatch Logs for Fluent Bit](https://github.com/aws/amazon-cloudwatch-logs-for-fluent-bit) 和 [Amazon Kinesis Firehose for Fluent Bit](https://github.com/aws/amazon-kinesis-firehose-for-fluent-bit)。

为了获得高可用性，Amazon ECR 公开映像浏览馆和 Amazon ECR 存储库上的 Amazon ECR 都提供了 **Amazon for Fluent Bit** 映像。

## Amazon ECR 公开映像浏览馆
<a name="firelens-image-ecrpublic"></a>

Amazon ECR 公开映像浏览馆提供了 Amazon for Fluent Bit 映像。这是下载 Amazon for Fluent Bit 映像的推荐位置，因为它是一个公共存储库，可从所有Amazon Web Services 区域区域使用。有关更多信息，请参阅 Amazon ECR 公开映像浏览馆上的 [aws-for-fluent-bit](https://gallery.ecr.aws/aws-observability/aws-for-fluent-bit)。

### Linux
<a name="firelens-image-ecrpublic-linux"></a>

Amazon ECR 公开映像浏览馆中的 Amazon for Fluent Bit 映像支持带有 `ARM64` 或 `x86-64` 架构的 Amazon Linux 操作系统。

通过使用所需的映像标记指定存储库 URL，可以从 Amazon ECR 公开映像浏览馆中提取 Amazon for Fluent Bit 映像。可在 Amazon ECR 公开映像浏览馆上的**映像标签**选项卡上找到映像标签。

下面说明 Docker CLI 使用的语法。

```
docker pull public.ecr.aws/aws-observability/aws-for-fluent-bit:tag
```

例如，您可以使用此 Docker CLI 命令拉取适用于 Fluent Bit 的 Amazon 版本的“3.x”系列中的最新映像。

```
docker pull public.ecr.aws/aws-observability/aws-for-fluent-bit:3
```

**注意**  
可以进行未经身份验证的拉取，但速率限制低于经过身份验证的拉取。拉取前如果要使用 Amazon 账户验证身份，请使用以下命令。  

```
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
```

#### Amazon for Fluent Bit 3.0.0
<a name="firelens-image-ecrpublic-linux-3.0.0"></a>

除了现有的 Amazon for Fluent Bit 版本 `2.x` 外，Amazon for Fluent Bit 还支持新的主要版本 `3.x`。新的主要版本包括将映像从 Amazon Linux 2 升级到 Amazon Linux 2023 以及将 Fluent Bit 版本 `1.9.10` 升级到 `4.1.1`。有关更多信息，请参阅 GitHub 上的 [Amazon for Fluent Bit 存储库](https://github.com/aws/aws-for-fluent-bit/blob/mainline/VERSIONS.md)。

以下示例展示了 Amazon for Fluent Bit `3.x` 映像更新后的标签：

您可以对 Amazon for Fluent Bit 映像使用多架构标签。

```
docker pull public.ecr.aws/aws-observability/aws-for-fluent-bit:3
```

### Windows
<a name="firelens-image-ecrpublic-windows"></a>

Amazon ECR 公开映像浏览馆中 Fluent Bit 映像的 Amazon 支持带有以下操作系统的 `AMD64` 架构：
+ Windows Server 2022 Full
+ Windows Server 2022 Core
+ Windows Server 2019 Full
+ Windows Server 2019 Core

Amazon Fargate 上的 Windows 容器不支持 FireLens。

通过使用所需的映像标记指定存储库 URL，可以从 Amazon ECR 公开映像浏览馆中提取 Amazon for Fluent Bit 映像。可在 Amazon ECR 公开映像浏览馆上的**映像标签**选项卡上找到映像标签。

下面说明 Docker CLI 使用的语法。

```
docker pull public.ecr.aws/aws-observability/aws-for-fluent-bit:tag
```

例如，您可以使用此 Docker CLI 命令拉取最新的稳定 Amazon for Fluent Bit 映像。

```
docker pull public.ecr.aws/aws-observability/aws-for-fluent-bit:windowsservercore-stable
```

**注意**  
可以进行未经身份验证的拉取，但速率限制低于经过身份验证的拉取。拉取前如果要使用 Amazon 账户验证身份，请使用以下命令。  

```
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
```

## Amazon ECR
<a name="firelens-image-ecr"></a>

Amazon for Fluent Bit 映像可在 Amazon ECR 上获得高可用性。可以使用以下命令来检索映像 URI 并确定映像在给定 Amazon Web Services 区域 区域的可用性。

### Linux
<a name="firelens-image-ecr-linux"></a>

可以使用以下命令检索最新的稳定 Amazon for Fluent Bit 映像 URI。

```
aws ssm get-parameters \
      --names /aws/service/aws-for-fluent-bit/stable \
      --region us-east-1
```

使用以下命令来查询 Systems Manager Parameter Store 参数可以列出 Amazon for Fluent Bit 映像的所有版本。

```
aws ssm get-parameters-by-path \
      --path /aws/service/aws-for-fluent-bit \
      --region us-east-1
```

可以通过引用 Systems Manager 参数存储名称在 Amazon CloudFormation 模板中引用最新的稳定 Amazon for Fluent Bit 映像。以下是示例：

```
Parameters:
  FireLensImage:
    Description: Fluent Bit image for the FireLens Container
    Type: AWS::SSM::Parameter::Value<String>
    Default: /aws/service/aws-for-fluent-bit/stable
```

**注意**  
如果命令失败或没有输出，则映像在调用该命令的 Amazon Web Services 区域不可用。

### Windows
<a name="firelens-image-ecr-windows"></a>

可以使用以下命令检索最新的稳定 Amazon for Fluent Bit 映像 URI。

```
aws ssm get-parameters \
      --names /aws/service/aws-for-fluent-bit/windowsservercore-stable \
      --region us-east-1
```

使用以下命令来查询 Systems Manager Parameter Store 参数可以列出 Amazon for Fluent Bit 映像的所有版本。

```
aws ssm get-parameters-by-path \
      --path /aws/service/aws-for-fluent-bit/windowsservercore \
      --region us-east-1
```

可以通过引用 Systems Manager 参数存储名称在 Amazon CloudFormation 模板中引用最新的稳定 Amazon for Fluent Bit 映像。以下是示例：

```
Parameters:
  FireLensImage:
    Description: Fluent Bit image for the FireLens Container
    Type: AWS::SSM::Parameter::Value<String>
    Default: /aws/service/aws-for-fluent-bit/windowsservercore-stable
```