Azure Cache for Redis は、ログに役立つ Server Load や Connections per Second などの多くのメトリックを出力します。 AllMetrics オプションを選択すると、これらのキャッシュ メトリックとその他のキャッシュ メトリックをログに記録できます。 メトリックが保持される期間を構成できます。
接続ログ
Azure Cache for Redis では、Azure 診断設定を使用して、キャッシュに対するクライアント接続に関する情報がログに記録されます。 この診断設定のログ記録と分析は、キャッシュに接続しているユーザーと、それらの接続のタイムスタンプを把握するのに役立ちます。 このログ データは、セキュリティ侵害の範囲を特定するため、およびセキュリティ監査の目的に使用できます。
接続ログは、Azure Cache for Redis のレベルが異なると、実装、内容、およびセットアップ手順が若干異なります。 詳細については、Azure Monitor の診断設定に関する記事を参照してください。
指定された IP アドレス範囲内の 1 時間あたりの Azure Cache for Redis クライアント接続:
let IpRange = "10.1.1.0/24";
ACRConnectedClientList
// For particular datetime filtering, add '| where TimeGenerated between (StartTime .. EndTime)'
| where ipv4_is_in_range(ClientIp, IpRange)
| summarize ConnectionCount = sum(ClientCount) by TimeRange = bin(TimeGenerated, 1h)
キャッシュに接続している一意の Redis クライアント IP アドレス:
ACRConnectedClientList
| summarize count() by ClientIp
指定された IP アドレス範囲内の 1 時間あたりの Azure Cache for Redis 接続数:
REDConnectionEvents
// For particular datetime filtering, add '| where EventTime between (StartTime .. EndTime)'
// For particular IP range filtering, add '| where ipv4_is_in_range(ClientIp, IpRange)'
// IP range can be defined like this 'let IpRange = "10.1.1.0/24";' at the top of query.
| extend EventTime = unixtime_seconds_todatetime(EventEpochTime)
| where EventType == "new_conn"
| summarize ConnectionCount = count() by TimeRange = bin(EventTime, 1h)
指定された IP アドレス範囲内の 1 時間あたりの Azure Cache for Redis 認証要求数:
REDConnectionEvents
| extend EventTime = unixtime_seconds_todatetime(EventEpochTime)
// For particular datetime filtering, add '| where EventTime between (StartTime .. EndTime)'
// For particular IP range filtering, add '| where ipv4_is_in_range(ClientIp, IpRange)'
// IP range can be defined like this 'let IpRange = "10.1.1.0/24";' at the top of query.
| where EventType == "auth"
| summarize AuthenticationRequestsCount = count() by TimeRange = bin(EventTime, 1h)
キャッシュに接続している一意の Redis クライアント IP アドレス:
REDConnectionEvents
// https://docs.redis.com/latest/rs/security/audit-events/#status-result-codes
// EventStatus :
// 0 AUTHENTICATION_FAILED - Invalid username and/or password.
// 1 AUTHENTICATION_FAILED_TOO_LONG - Username or password are too long.
// 2 AUTHENTICATION_NOT_REQUIRED - Client tried to authenticate, but authentication isn’t necessary.
// 3 AUTHENTICATION_DIRECTORY_PENDING - Attempting to receive authentication info from the directory in async mode.
// 4 AUTHENTICATION_DIRECTORY_ERROR - Authentication attempt failed because there was a directory connection error.
// 5 AUTHENTICATION_SYNCER_IN_PROGRESS - Syncer SASL handshake. Return SASL response and wait for the next request.
// 6 AUTHENTICATION_SYNCER_FAILED - Syncer SASL handshake. Returned SASL response and closed the connection.
// 7 AUTHENTICATION_SYNCER_OK - Syncer authenticated. Returned SASL response.
// 8 AUTHENTICATION_OK - Client successfully authenticated.
| where EventType == "auth" and EventStatus == 2 or EventStatus == 8 or EventStatus == 7
| summarize count() by ClientIp
キャッシュに対する認証試行の失敗
REDConnectionEvents
// https://docs.redis.com/latest/rs/security/audit-events/#status-result-codes
// EventStatus :
// 0 AUTHENTICATION_FAILED - Invalid username and/or password.
// 1 AUTHENTICATION_FAILED_TOO_LONG - Username or password are too long.
// 2 AUTHENTICATION_NOT_REQUIRED - Client tried to authenticate, but authentication isn’t necessary.
// 3 AUTHENTICATION_DIRECTORY_PENDING - Attempting to receive authentication info from the directory in async mode.
// 4 AUTHENTICATION_DIRECTORY_ERROR - Authentication attempt failed because there was a directory connection error.
// 5 AUTHENTICATION_SYNCER_IN_PROGRESS - Syncer SASL handshake. Return SASL response and wait for the next request.
// 6 AUTHENTICATION_SYNCER_FAILED - Syncer SASL handshake. Returned SASL response and closed the connection.
// 7 AUTHENTICATION_SYNCER_OK - Syncer authenticated. Returned SASL response.
// 8 AUTHENTICATION_OK - Client successfully authenticated.
| where EventType == "auth" and EventStatus != 2 and EventStatus != 8 and EventStatus != 7
| project ClientIp, EventStatus, ConnectionId