1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【IBM Application Gateway】Cloudwatch に送ったリクエストログ・監査ログをフィルタリング、ダウンロードする

Last updated at Posted at 2023-02-02

はじめに

IBM Application Gatewayを、AWS ECS/Fargate環境にデプロイしました。
Cloudwatch Logsに出力したリクエストログと監査ログを、フィルタリング、外部出力できるか確認しました。

1.ログ出力設定

リクエストはデフォルトでコンテナの標準出力に表示されます。監査ログを出力、ログの出力フォーマンっとをJSON形式に変更しました。

logging:
  json_logging: true
  components:
    - audit.authn
    - audit.azn

2.CloudWatchでのログ出力確認

ロググループでコンテナのログを選択します。
image.png

「すべてのログストリームを検索」を選択します。
image.png

コンテナのログが確認できます。

  • リクエストログ: Levelが"INFO"
  • 監査ログ: Levelが"AUDIT"
    image.png

3.ログのフィルタリング

リクエストログと監査ログが混在するため、フィルタリングしてみました。

LevelがAUDITのログのみ表示するため、下記キーワードで検索します。
構文についてはCloudWatchのユーザーガイド フィルターとパターンの構文 を参考にしました。

{ $.level= "AUDIT" }

image.png

4.ログをダウンロードする

CloudWatchメニューからダウンロードできました。

アクション-検索結果をダウンロード(CSV) を選択します。
isva-aws-000080.png

ダウンロードしたファイル名と、含まれるデータは次のようになっていました。
ファイル名

log-events-viewer-result.csv

データ

timestamp,message,logStreamName

サンプル
image.png

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?