Auth0 のログの収集
この手順では、Auth0 からエラー ログを収集する方法について説明します。
ログ タイプ
Sumo Logic は次のログ タイプを収集します。
- ログイン (正常とエラーの両方)
- トークン交換 (正常とエラーの両方)
- ログイン中の警告
- ユーザの削除
- ログイン失敗の理由
- 接続エラー
- ユーザ登録イベント
- 検証メール イベント
- パスワードの変更
- レート制限イベント
- その他の運用に関するイベントおよびエラー
Auth0 ログの詳細については、https://auth0.com/docs/api/managemen.../Logs/get_logs を参照してください。
前提条件
Auth0 管理ポータルを使用して拡張機能を設定します。 詳細については、https://auth0.com/docs/extensions/sumologic を参照してください。
Collector の設定
Sumo Logic セットアップ ウィザードを使用してカスタム アプリケーションを設定します。
Source の設定
Source タイプは HTTP です。
Source の設定
- Name (名前): 必須
- Category (カテゴリ):
- Timestamp Parsing Settings (タイムスタンプ parse 設定):
- Enable Timestamp Parsing (タイムスタンプ parse の有効化): true
- Timezone (タイムゾーン): ログはデフォルトで UTC で送信され、自動的に検出できます。
- Timestamp Format (タイムスタンプ形式): [Specify a format (形式を指定)] を選択して、以下を指定します。
Format (形式):
yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
Timestamp locator (タイムスタンプ ロケータ):
"date":"(.*?)\","
- Multi-line Parsing Settings (複数行の parse の設定):
- Detect Messages Spanning Multiple Lines (複数行にわたるメッセージを検出する): true
- Multi Line Boundary (複数行の境界): 境界の推測
FER (Field Extraction Rules)
Parse Expression (parse 式): json "date", "type", "client_id", "client_name", "ip", "user_id"
ログ メッセージのサンプル
例 1:
{ "date": "2016-02-23T19:57:29.532Z", "type": "sapi", "client_id": "AaiyAPdpYdesoKnqjj8HJqRn4T5titww", "client_name": "My application Name", "ip": "190.257.209.19", "location_info": {}, "details": {}, "user_id": "auth0|56c75c4e42b6359e98374bc2" }
例 2:
{ "date": "2016-11-14T21:50:33.473Z", "type": "fp", "description": "Wrong email or password.", "connection": "Username-Password-Authentication", "connection_id": "con_ABCDEF", "client_id": "123987LKJsdfmnb", "client_name": "www.sumologic.com", "ip": "198.0.217.157", "user_agent": "Other 0.0.0 / Other 0.0.0", "details": { "error": { "message": "Wrong email or password." } }, "user_id": "auth0|123ASD987", "user_name": "noone@sumologic.com", "strategy": "auth0", "strategy_type": "database", "_id": "321654987654321654987654321", "isMobile": false }
クエリのサンプル
1 日あたりのクライアント別ログイン
_collector="productionappauth0Logs_Collector"
| json "client_name"
| where client_name != ""
| timeslice by 1d
| count by _timeslice, client_name
| transpose row _timeslice column client_name
クライアント バージョンの使用率
_collector="productionappauth0Logs_Collector"
| json "auth0_client.name", "auth0_client.version"
| concat(%auth0_client.name, " ", %auth0_client.version) as auth0_client_version
| timeslice 1h
| count by _timeslice, auth0_client_version
| transpose row _timeslice column auth0_client_version
上位 10 件の最近のエラー
_collector="productionappauth0Logs_Collector"
| json "type", "connection", "description", "client_name"
| where type != "slo"
| count client_name, connection, description
| top 10 client_name, connection, description by _count