Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Loki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Loki
Commits
f74f2c82
Commit
f74f2c82
authored
5 years ago
by
Robert Fratto
Committed by
sh0rez
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
feat(logcli): add --to flag to specify latest RFC3339 time for query (#776)
Fixes #774
parent
4bf77662
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/logcli/main.go
+2
-1
2 additions, 1 deletion
cmd/logcli/main.go
cmd/logcli/query.go
+9
-1
9 additions, 1 deletion
cmd/logcli/query.go
with
11 additions
and
2 deletions
cmd/logcli/main.go
+
2
−
1
View file @
f74f2c82
...
...
@@ -26,7 +26,8 @@ var (
regexpStr
=
queryCmd
.
Arg
(
"regex"
,
""
)
.
String
()
limit
=
queryCmd
.
Flag
(
"limit"
,
"Limit on number of entries to print."
)
.
Default
(
"30"
)
.
Int
()
since
=
queryCmd
.
Flag
(
"since"
,
"Lookback window."
)
.
Default
(
"1h"
)
.
Duration
()
from
=
queryCmd
.
Flag
(
"from"
,
"Start looking for logs at this absolute time"
)
.
String
()
from
=
queryCmd
.
Flag
(
"from"
,
"Start looking for logs at this absolute time (inclusive)"
)
.
String
()
to
=
queryCmd
.
Flag
(
"to"
,
"Stop looking for logs at this absolute time (exclusive)"
)
.
String
()
forward
=
queryCmd
.
Flag
(
"forward"
,
"Scan forwards through logs."
)
.
Default
(
"false"
)
.
Bool
()
tail
=
queryCmd
.
Flag
(
"tail"
,
"Tail the logs"
)
.
Short
(
't'
)
.
Default
(
"false"
)
.
Bool
()
delayFor
=
queryCmd
.
Flag
(
"delay-for"
,
"Delay in tailing by number of seconds to accumulate logs"
)
.
Default
(
"0"
)
.
Int
()
...
...
This diff is collapsed.
Click to expand it.
cmd/logcli/query.go
+
9
−
1
View file @
f74f2c82
...
...
@@ -29,7 +29,15 @@ func doQuery() {
var
err
error
start
,
err
=
time
.
Parse
(
time
.
RFC3339Nano
,
*
from
)
if
err
!=
nil
{
log
.
Fatalf
(
"error parsing date '%s': %s"
,
*
from
,
err
)
log
.
Fatalf
(
"error parsing --from date '%s': %s"
,
*
from
,
err
)
}
}
if
*
to
!=
""
{
var
err
error
end
,
err
=
time
.
Parse
(
time
.
RFC3339Nano
,
*
to
)
if
err
!=
nil
{
log
.
Fatalf
(
"error parsing --to date '%s': %s"
,
*
to
,
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment