Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(68)

Issue 58510045: debug-log: added new debug log api and command

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 3 months ago by mue
Modified:
10 years, 2 months ago
Reviewers:
dimitern, mp+203955, fwereade, rog
Visibility:
Public.

Description

debug-log: added new debug log api and command Second approach based on the idea of Roger. It uses an own handler using a web socket connection for the streaming of the log. The initial call is a request to the URL wss://<STATESERVER>:<PORT>/log?lines=<N>&filter=<REGEXP> The command also handles older environments without the WatchDebugLog API. This is done as before using SSH or simply tail the local file. Beside the number of lines the command and the function take also a regular expression for filtering. Both are optional. The default number of lines is 10, the empty filter lets all log lines pass. juju debug-log -n 25 -f "^machine-1" The current solution works for both, local and non-local environments. What's missing: - Currently only tested live. Unit tests have to be developed and added. https://code.launchpad.net/~themue/juju-core/060-debug-log-api-and-cmd/+merge/203955 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 28

Patch Set 2 : debug-log: added new debug log api and command #

Patch Set 3 : debug-log: added new debug log api and command #

Patch Set 4 : debug-log: added new debug log api and command #

Total comments: 72

Patch Set 5 : debug-log: added new debug log api and command #

Patch Set 6 : debug-log: added new debug log api and command #

Total comments: 8

Patch Set 7 : debug-log: added new debug log api and command #

Total comments: 1

Patch Set 8 : debug-log: added new debug log api and command #

Total comments: 17
Unified diffs Side-by-side diffs Delta from patch set Stats (+442 lines, -136 lines) Patch
A [revision details] View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/debuglog.go View 1 2 3 4 5 6 7 2 chunks +101 lines, -60 lines 4 comments Download
M cmd/juju/debuglog_test.go View 1 chunk +0 lines, -56 lines 1 comment Download
M cmd/juju/main.go View 1 chunk +1 line, -1 line 0 comments Download
M environs/config/config.go View 1 2 3 4 5 6 7 7 chunks +20 lines, -0 lines 8 comments Download
M environs/config/config_test.go View 1 2 3 4 5 6 7 2 chunks +5 lines, -0 lines 0 comments Download
M provider/local/environ.go View 1 2 3 4 5 6 7 1 chunk +8 lines, -3 lines 0 comments Download
M state/api/apiclient.go View 1 2 chunks +14 lines, -8 lines 0 comments Download
M state/api/client.go View 1 2 3 4 5 6 3 chunks +75 lines, -1 line 0 comments Download
M state/api/client_test.go View 1 2 3 4 5 6 7 2 chunks +7 lines, -2 lines 0 comments Download
M state/api/export_test.go View 1 2 3 4 5 6 7 1 chunk +3 lines, -4 lines 0 comments Download
M state/api/params/internal.go View 1 2 3 4 5 6 1 chunk +10 lines, -0 lines 2 comments Download
M state/apiserver/apiserver.go View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
A state/apiserver/debuglog.go View 1 2 3 4 5 6 7 1 chunk +194 lines, -0 lines 2 comments Download

Messages

Total messages: 23
mue
Please take a look.
10 years, 3 months ago (2014-01-30 13:15:25 UTC) #1
rog
Looking good so far. A few comments and suggestions below. https://codereview.appspot.com/58510045/diff/1/cmd/juju/debuglog.go File cmd/juju/debuglog.go (right): https://codereview.appspot.com/58510045/diff/1/cmd/juju/debuglog.go#newcode46 ...
10 years, 3 months ago (2014-01-30 14:34:09 UTC) #2
mue
Please take a look. https://codereview.appspot.com/58510045/diff/1/cmd/juju/debuglog.go File cmd/juju/debuglog.go (right): https://codereview.appspot.com/58510045/diff/1/cmd/juju/debuglog.go#newcode46 cmd/juju/debuglog.go:46: f.StringVar(&c.entities, "e", "", "filter the ...
10 years, 3 months ago (2014-01-30 16:55:20 UTC) #3
mue
Please take a look.
10 years, 3 months ago (2014-01-31 15:07:01 UTC) #4
mue
Please take a look.
10 years, 3 months ago (2014-01-31 15:30:08 UTC) #5
rog
A few more thoughts. Still waiting for the tests... https://codereview.appspot.com/58510045/diff/1/state/apiserver/common.go File state/apiserver/common.go (right): https://codereview.appspot.com/58510045/diff/1/state/apiserver/common.go#newcode20 state/apiserver/common.go:20: ...
10 years, 3 months ago (2014-01-31 15:59:11 UTC) #6
dimitern
Some observations and suggestions. https://codereview.appspot.com/58510045/diff/60001/cmd/juju/debuglog.go File cmd/juju/debuglog.go (right): https://codereview.appspot.com/58510045/diff/60001/cmd/juju/debuglog.go#newcode28 cmd/juju/debuglog.go:28: Stream the consolidated log file. ...
10 years, 3 months ago (2014-01-31 17:02:29 UTC) #7
dimitern
Forgot to mention, please update the CL description (it no longer takes -e entities).
10 years, 3 months ago (2014-01-31 17:03:04 UTC) #8
rog
https://codereview.appspot.com/58510045/diff/60001/state/apiserver/charms.go File state/apiserver/charms.go (right): https://codereview.appspot.com/58510045/diff/60001/state/apiserver/charms.go#newcode18 state/apiserver/charms.go:18: envtesting "launchpad.net/juju-core/environs/testing" On 2014/01/31 17:02:29, dimitern wrote: > On ...
10 years, 3 months ago (2014-01-31 17:27:17 UTC) #9
mue
First feedback before continue on Monday. I'm a bit frustrated. I've got the problem of ...
10 years, 3 months ago (2014-01-31 17:32:37 UTC) #10
dimitern
Replies.. I didn't mean to suggest against what William and Roger told you, but just ...
10 years, 3 months ago (2014-01-31 17:57:09 UTC) #11
mue
Please take a look. https://codereview.appspot.com/58510045/diff/60001/cmd/juju/debuglog.go File cmd/juju/debuglog.go (right): https://codereview.appspot.com/58510045/diff/60001/cmd/juju/debuglog.go#newcode28 cmd/juju/debuglog.go:28: Stream the consolidated log file. ...
10 years, 2 months ago (2014-02-02 20:11:54 UTC) #12
mue
Please take a look.
10 years, 2 months ago (2014-02-03 08:52:14 UTC) #13
rog
A few comments pending unit tests. https://codereview.appspot.com/58510045/diff/100001/cmd/juju/debuglog.go File cmd/juju/debuglog.go (right): https://codereview.appspot.com/58510045/diff/100001/cmd/juju/debuglog.go#newcode86 cmd/juju/debuglog.go:86: args := append([]string{"0"}, ...
10 years, 2 months ago (2014-02-03 14:01:11 UTC) #14
mue
Please take a look. https://codereview.appspot.com/58510045/diff/100001/cmd/juju/debuglog.go File cmd/juju/debuglog.go (right): https://codereview.appspot.com/58510045/diff/100001/cmd/juju/debuglog.go#newcode86 cmd/juju/debuglog.go:86: args := append([]string{"0"}, tailcmd) On ...
10 years, 2 months ago (2014-02-10 16:07:47 UTC) #15
rog
Looks good, thanks, pending unit tests. https://codereview.appspot.com/58510045/diff/120001/cmd/juju/debuglog.go File cmd/juju/debuglog.go (right): https://codereview.appspot.com/58510045/diff/120001/cmd/juju/debuglog.go#newcode90 cmd/juju/debuglog.go:90: grepCmd := exec.Command("grep", ...
10 years, 2 months ago (2014-02-10 16:24:49 UTC) #16
mue
Please take a look.
10 years, 2 months ago (2014-02-14 15:49:27 UTC) #17
fwereade
A few comments; I'd like rog to check it as well, please. https://codereview.appspot.com/58510045/diff/140001/cmd/juju/debuglog.go File cmd/juju/debuglog.go ...
10 years, 2 months ago (2014-02-17 13:34:41 UTC) #18
rog
Some responses to William's remarks. https://codereview.appspot.com/58510045/diff/140001/environs/config/config.go File environs/config/config.go (right): https://codereview.appspot.com/58510045/diff/140001/environs/config/config.go#newcode167 environs/config/config.go:167: c.defined["log-location"] = DefaultLogLocation On ...
10 years, 2 months ago (2014-02-17 14:01:28 UTC) #19
fwereade
responses to responses ;) https://codereview.appspot.com/58510045/diff/140001/environs/config/config.go File environs/config/config.go (right): https://codereview.appspot.com/58510045/diff/140001/environs/config/config.go#newcode167 environs/config/config.go:167: c.defined["log-location"] = DefaultLogLocation On 2014/02/17 ...
10 years, 2 months ago (2014-02-18 08:39:35 UTC) #20
fwereade
Hey, another thought. `filter=<REGEXP>` is a bit of a layer violation -- it means that ...
10 years, 2 months ago (2014-02-18 08:48:33 UTC) #21
rog
https://codereview.appspot.com/58510045/diff/140001/environs/config/config.go File environs/config/config.go (right): https://codereview.appspot.com/58510045/diff/140001/environs/config/config.go#newcode809 environs/config/config.go:809: "log-location", On 2014/02/18 08:39:36, fwereade wrote: > On 2014/02/17 ...
10 years, 2 months ago (2014-02-18 10:06:21 UTC) #22
fwereade
10 years, 2 months ago (2014-02-18 15:36:24 UTC) #23
On 2014/02/18 10:06:21, rog wrote:
> https://codereview.appspot.com/58510045/diff/140001/environs/config/config.go
> File environs/config/config.go (right):
> 
>
https://codereview.appspot.com/58510045/diff/140001/environs/config/config.go...
> environs/config/config.go:809: "log-location",
> On 2014/02/18 08:39:36, fwereade wrote:
> > On 2014/02/17 14:01:28, rog wrote:
> > > On 2014/02/17 13:34:42, fwereade wrote:
> > > > ...and tbh I'm worried that making this user-configurable will lead to
all
> > > sorts
> > > > of ugliness. What happens if they set-env in a running environment? Does
> > > rsyslog
> > > > *always* use the right one? etc etc
> > > 
> > > I queried that too, but it's in immutableAttributes, so won't it be ok?
> > 
> > Good point about immutableAttributes, but I'm still worried: I just counted
31
> > `/var/log/juju`s in trunk, and if we're not fixing all of them then this
> > configurability is just going to break stuff. 
> 
> I count only 11, but point taken.

I think I probably counted test files too. And I *think* that's the right thing
to do when considering impact of a fix. But, ehh.

> We should probably change things so that the user *cannot* specify
> the log-location (for example by changing environs.Prepare to check
> that it's not set). Then it can only be set by the provider.
> 
> But that's not to say that all the /var/log/juju cases are currently
> correct, even in the existing situation. We should check.

Could do, but I think I like your agent.Conf idea more.

For the record, I'm rejecting this specific branch so that Frank can go work on
hardware enablement bugs; dimitern's taking over this work in the hope of
landing it for 1.18.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b