API 로그에 사용자/테넌트 정보 및 그룹핑 기능 추가
- LogApiRequest 미들웨어에서 app('api_user'), app('tenant_id') 사용
- 5초 TTL 캐시 기반 group_id 생성으로 연관 API 호출 그룹핑
- group_id 컬럼 추가 마이그레이션
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('api_request_logs', function (Blueprint $table) {
|
||||
$table->string('group_id', 50)->nullable()->after('tenant_id')->comment('요청 그룹 ID (연관 API 묶음)');
|
||||
$table->index('group_id');
|
||||
$table->index(['tenant_id', 'user_id', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('api_request_logs', function (Blueprint $table) {
|
||||
$table->dropIndex(['group_id']);
|
||||
$table->dropIndex(['tenant_id', 'user_id', 'created_at']);
|
||||
$table->dropColumn('group_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user