-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[APP-6612] Add Filters for Downloading Logs #4673
base: main
Are you sure you want to change the base?
Conversation
…gs to text or json file
…ng the logs, instead of retrieving all of the logs and then writing them all to the file
…ck when writing to file
…t arguments to be paired - either both are provided, or an error will be displated
…ds called on the *viamClient
… logs cli command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! There were some changes in flag names that were recently merged in, but I don't suspect it should affect your PR too much
cli/app.go
Outdated
&cli.StringFlag{ | ||
Name: logsFlagOutputFile, | ||
Usage: "path to output file", | ||
}, | ||
&cli.StringFlag{ | ||
Name: logsFlagFormat, | ||
Usage: "file format (text or json)", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe mention needs format flag
, needs output flag
for the users in the usage text? Not sure if necessary, but a suggestion, since I feel like I would read that as being able to format it when printing to console as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can decide the format when printing to the console! The command will default to text if the format
flag is not included. Are you suggesting something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you can also format it for the console! Ignore me then :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple small things but generally lgtm
cli/app.go
Outdated
logsFlagFormat = "format" | ||
logsFlagOutputFile = "output" | ||
logsFlagKeyword = "keyword" | ||
logsFlagLevels = "levels" | ||
logsFlagStartTime = "start" | ||
logsFlagEndTime = "end" | ||
logsFlagErrors = "errors" | ||
logsFlagTail = "tail" | ||
logsFlagCount = "count" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like some of these were added in a separate PR already. Would you mind pulling down main so we can get a more up-to-date look at what the diff is precisely?
cli/app.go
Outdated
logsFlagStartTime = "start" | ||
logsFlagEndTime = "end" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) I'm gonna ask you to do a bit of bookkeeping for us here if you don't mind! We already have a "start" flag and an "end" flag (dataFlagStart
and dataFlagEnd
). Would you be willing to rename those to generalFlagStart
and generalFlagEnd
and then update call sites so that there's only the single instance of a --start
or --end
flag?
…s-For-Downloading-Logs
…Time to generalFlagStart and generalFlagEnd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jr22 - Is there a reason we don't have unit tests for this function's helpers? Should I add unit tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a reason that im aware of, feel free to add test coverage if you want!
51a5dae
to
5c75c18
Compare
5c75c18
to
4434cbb
Compare
4434cbb
to
31ae536
Compare
31ae536
to
0b85f4e
Compare
0b85f4e
to
b8a5d77
Compare
This PR implements additional filters to the machines logs CLI command, specifically:
keyword
,start time
,end time
andlog level
. Below are the details and test cases for the command:See ticket here
Invalid: Without any arguments
With Keyword Filter
With Error Level
Start Time
Start from after the last log
The most recent few logs
Logs from a slightly earlier start time
Invalid: Cannot use start and count without end.
End Time
Notice how in the second screenshot, we skip the logs passed 15:16.
Start & End Time
Start + Count + End Time
Edge Case
Do we not want to output something prettier if there are no logs to display?
Without providing
count
, defaults to 100 logscount
of 10,000 workscount
of 10,001 does not work@jr22 - I personally do not love that when surpassing the maxLogs we still display the following: