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

Oracle Functions (Fn) で 実行時のログを表示

Last updated at Posted at 2019-02-20

はじめに

Oracle Functions では、サーバレスなFaaSを提供しています。2019年2月現在のOracle Functions は、Limited Available となっており、一部の機能のみを先行して使用出来る環境となっています。
この記事では、Function の実行が失敗した時の実行logやエラーlogを表示する方法を記載します。
Limited Available の環境では、Syslogサーバを独自に準備する必要があります。個人的な予想だと、GAするタイミングで、Oracle Cloud の logging サービスと統合するのではないかなと思います。(っていうか統合してほしい)

Papertrailとは

Pappertrailとは、loggingのためのSaaSです。ほぼリアルタイムにログを収集し、シンプルな操作で表示・検索することが出来ます。無料枠を使用して、Papertrailで Function の log を表示していきます。

Papertrail で log送付先を作成

  • PapertrailでAccount作成後、Login
  • Settings メニューを選択
  • Log Destinations > Create Log Destinations
    • Plain text にチェックを入れて、Create
  • 表示された送付先をメモ 例 : logs1.papertrailapp.com:60000

Fn cli で log送付先を設定

fn update コマンドで、Papertrailのlog送付先を指定します。

fn update app env-app --syslog-url tcp://logs1.papertrailapp.com:60000

fn invoke コマンドで、Function を実行します。なお、Functionで実行したときの、標準出力と標準エラー出力が Papertrail に保存されます。

fn --verbose invoke env-app oci-lb-list

Papertrailでlogを確認

  • Dashboard メニューを選択
  • Dashboardに、logが自動的に追加されている
  • logをクリックすると、syslog経由で送付された文字列がリアルタイムに表示されます
  • リアルタイムに表示されるので、debug がやりやすく使いやすいです。

001.jpg

参考URL

3
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
3
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?