Skip to content

Commit 04b8ea5

Browse files
committed
fix(q-dev): auto-scan logging path without extra config
Kiro exports to two well-known S3 prefixes in the same bucket: - user-report/AWSLogs/{accountId}/KiroLogs/ (CSV reports) - logging/AWSLogs/{accountId}/KiroLogs/ (interaction logs) When AccountId is set, automatically scan both paths. The "logging" prefix is hardcoded since it's a standard Kiro export convention. No additional configuration needed.
1 parent ac7622d commit 04b8ea5

2 files changed

Lines changed: 20 additions & 17 deletions

File tree

backend/plugins/q_dev/impl/impl.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,21 @@ func (p QDev) PrepareTaskData(taskCtx plugin.TaskContext, options map[string]int
130130
if op.Month != nil {
131131
timePart = fmt.Sprintf("%04d/%02d", op.Year, *op.Month)
132132
}
133-
base := fmt.Sprintf("%s/AWSLogs/%s/KiroLogs", op.BasePath, op.AccountId)
134-
loggingBasePath := op.LoggingBasePath
135-
if loggingBasePath == "" {
136-
loggingBasePath = "logging"
133+
// Kiro exports data to two well-known S3 prefixes:
134+
// {basePath}/AWSLogs/{accountId}/KiroLogs/ — user report CSVs
135+
// logging/AWSLogs/{accountId}/KiroLogs/ — interaction logs (JSON.gz)
136+
// When basePath is empty, default to "user-report" for CSV data.
137+
reportBase := op.BasePath
138+
if reportBase == "" {
139+
reportBase = "user-report"
137140
}
138-
loggingBase := fmt.Sprintf("%s/AWSLogs/%s/KiroLogs", loggingBasePath, op.AccountId)
141+
csvBase := fmt.Sprintf("%s/AWSLogs/%s/KiroLogs", reportBase, op.AccountId)
142+
logBase := fmt.Sprintf("logging/AWSLogs/%s/KiroLogs", op.AccountId)
139143
s3Prefixes = []string{
140-
fmt.Sprintf("%s/by_user_analytic/%s/%s", base, region, timePart),
141-
fmt.Sprintf("%s/user_report/%s/%s", base, region, timePart),
142-
fmt.Sprintf("%s/GenerateAssistantResponse/%s/%s", loggingBase, region, timePart),
143-
fmt.Sprintf("%s/GenerateCompletions/%s/%s", loggingBase, region, timePart),
144+
fmt.Sprintf("%s/by_user_analytic/%s/%s", csvBase, region, timePart),
145+
fmt.Sprintf("%s/user_report/%s/%s", csvBase, region, timePart),
146+
fmt.Sprintf("%s/GenerateAssistantResponse/%s/%s", logBase, region, timePart),
147+
fmt.Sprintf("%s/GenerateCompletions/%s/%s", logBase, region, timePart),
144148
}
145149
} else {
146150
// Legacy scope: use S3Prefix directly

backend/plugins/q_dev/tasks/task_data.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ type QDevApiParams struct {
2626
}
2727

2828
type QDevOptions struct {
29-
ConnectionId uint64 `json:"connectionId"`
30-
S3Prefix string `json:"s3Prefix"`
31-
ScopeId string `json:"scopeId"`
32-
AccountId string `json:"accountId"`
33-
BasePath string `json:"basePath"`
34-
LoggingBasePath string `json:"loggingBasePath"`
35-
Year int `json:"year"`
36-
Month *int `json:"month"`
29+
ConnectionId uint64 `json:"connectionId"`
30+
S3Prefix string `json:"s3Prefix"`
31+
ScopeId string `json:"scopeId"`
32+
AccountId string `json:"accountId"`
33+
BasePath string `json:"basePath"`
34+
Year int `json:"year"`
35+
Month *int `json:"month"`
3736
}
3837

3938
type QDevTaskData struct {

0 commit comments

Comments
 (0)