Skip to content

Commit a90655b

Browse files
committed
feat(cli): add time filter to log fetching
1 parent 5964fde commit a90655b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cli/commands/logs.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,18 @@ export const logsCommand = ({
3838
flags: '-X, --deleteLogGroups',
3939
description: 'delete log groups afterwards',
4040
},
41+
{
42+
flags: '-a, --age',
43+
description: 'age of logs in minutes (defaults to 5 minutes)',
44+
},
4145
],
42-
action: async ({ numLogGroups, numLogStreams, filter, deleteLogGroups }) => {
46+
action: async ({
47+
numLogGroups,
48+
numLogStreams,
49+
filter,
50+
deleteLogGroups,
51+
age,
52+
}) => {
4353
const logGroups =
4454
(
4555
await cf.send(
@@ -102,6 +112,8 @@ export const logsCommand = ({
102112
numLogStreams !== undefined
103113
? parseInt(numLogStreams, 10)
104114
: 100,
115+
endTime: Date.now(),
116+
startTime: Date.now() - parseInt(age ?? '5', 10) * 60 * 1000,
105117
}),
106118
),
107119
),

0 commit comments

Comments
 (0)