Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

api_service: Implement GetLogs RPC request #2662

Merged
merged 6 commits into from May 27, 2016

Conversation

iaguis
Copy link
Member

@iaguis iaguis commented May 19, 2016

Allows being able to get the logs of a pod with the API service without forking off journalctl.

Fixes #1970

Depends on coreos/go-systemd#160

@@ -1,6 +1,8 @@
# Configures rkt tests at Travis CI (https://travis-ci.org).

language: go
sudo: required
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary given we were already sudoing things?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iaguis
Copy link
Member Author

iaguis commented May 20, 2016

Updated.

@iaguis
Copy link
Member Author

iaguis commented May 23, 2016

PTAL.

@@ -236,23 +236,28 @@
},
{
"ImportPath": "github.com/coreos/go-systemd/activation",
"Comment": "v5",
"Rev": "7b2428fec40033549c68f54e26e89e7ca9a9ce31"
"Comment": "v6-4-g0f21494",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a tagged version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+:100:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucab I see you tagged the last version of go-systemd. Could you tag yet another version for this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iaguis
Copy link
Member Author

iaguis commented May 25, 2016

Updated

@jellonek
Copy link
Contributor

Will this work on systems without systemd/journald?

@iaguis
Copy link
Member Author

iaguis commented May 25, 2016

Will this work on systems without systemd/journald?

Nope

@jellonek
Copy link
Contributor

ack.

}
jconf.Matches = []sdjournal.Match{
{
Field: sdjournal.SD_JOURNAL_FIELD_SYSTEMD_UNIT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Susceptible to the race mentioned in #2630? Should this use the SYSLOG_IDENTIFIER instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, forgot to update that after #2630

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iaguis
Copy link
Member Author

iaguis commented May 26, 2016

Updated. Pending on a go-systemd release.

@jonboulle
Copy link
Contributor

I assigned on to @lucab

On Thu, May 26, 2016 at 3:03 PM, Iago López Galeiras <
notifications@github.com> wrote:

Updated. Pending on a go-systemd release.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#2662 (comment)

@lucab
Copy link
Member

lucab commented May 26, 2016

Tagged go-systemd v8: https://github.com/coreos/go-systemd/releases/tag/v8

@iaguis
Copy link
Member Author

iaguis commented May 26, 2016

Tagged go-systemd v8: https://github.com/coreos/go-systemd/releases/tag/v8

Thanks!

}

s.mu.Lock()
jr, ok := s.journalReaders[request.PodId]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since jconf is where all request configuration ends up, but isn't used here, would recycling a reader lose that configuration?

e.g. I call once with tail=10 and a reader is created and cached with that configuration, and then I call again with tail=1000 and still only get 10 lines because the cached journalReader has that config.

Copy link
Member Author

@iaguis iaguis May 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I think we should go back to one JournalReader per call... @jonboulle

@alban
Copy link
Member

alban commented May 27, 2016

Can we have tests? :)
In a follow-up issue?

@iaguis
Copy link
Member Author

iaguis commented May 27, 2016

Can we have tests? :)
In a follow-up issue?

Definitely

@iaguis
Copy link
Member Author

iaguis commented May 27, 2016

I'll revert kinvolk@e1fc014

@iaguis
Copy link
Member Author

iaguis commented May 27, 2016

Updated.

})
if err != nil {
fmt.Println(err)
os.Exit(2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 2?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno, this stupid error numbering. I guess it should be 3, and then 4, and then 5. I can just get rid of those like we did with init.go some time ago

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, sequential numbering never works, settle on 1 unless you wanted to
try use something like http://linux.die.net/include/sysexits.h

On Fri, May 27, 2016 at 2:21 PM, Iago López Galeiras <
notifications@github.com> wrote:

In api/v1alpha/client_example.go
#2662 (comment):

@@ -51,6 +51,24 @@ func main() {

for _, p := range podResp.Pods {
    fmt.Printf("Pod %q is running\n", p.Id)
  •   logsResp, err := c.GetLogs(context.Background(), &v1alpha.GetLogsRequest{
    
  •       PodId: p.Id,
    
  •   })
    
  •   if err != nil {
    
  •       fmt.Println(err)
    
  •       os.Exit(2)
    

Dunno, this stupid error numbering. I guess it should be 3, and then 4,
and then 5. I can just get rid of those like we did with init.go some time
ago


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/coreos/rkt/pull/2662/files/c28aa39ba2c92941f58487762ed66bf9e93d0d01..cc72b0fb026b3fb54a9a9bb24e29f5ed86f8df50#r64896509,
or mute the thread
https://github.com/notifications/unsubscribe/ACewN0s-tIsx_Ge3uE7wnpSOHppyL1lMks5qFuHKgaJpZM4IiF05
.

@iaguis
Copy link
Member Author

iaguis commented May 27, 2016

Updated

@alban
Copy link
Member

alban commented May 27, 2016

LGTM if green.

@iaguis iaguis merged commit 1ebb525 into rkt:master May 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants