0
0

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 5 years have passed since last update.

aws-sdk ruby v2でCloudWatchLogsのログストリームを取得する

Posted at

背景

Railsでログのフォーマッタとしてlogrageを使用しているのですが、クライアント側で参照する必要があるため。

呼び出し方

  • 初期化
client = Aws::CloudWatchLogs::Client.new(
  region: region_name,
  credentials: credentials
)
  • get_log_eventsでストリームオブジェクトを呼び出す
resp = client.get_log_events({
  log_group_name: "ロググループ名",
  log_stream_name: "ログストリーム名"
}

resp.events #=> Array
resp.events[0].timestamp #=> Integer
resp.events[0].message #=> String
resp.events[0].ingestion_time #=> Integer

参照

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?