Skip to content
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

add journal support #33

Merged
merged 5 commits into from
Nov 3, 2016
Merged

add journal support #33

merged 5 commits into from
Nov 3, 2016

Conversation

adohe-zz
Copy link
Contributor

@adohe-zz adohe-zz commented Sep 16, 2016

needs to fix dependency and add test.

@adohe-zz adohe-zz changed the title add journal support [WIP] add journal support Sep 16, 2016
return
}
if line == "" {
time.Since(100 * time.Millisecond)
Copy link
Member

Choose a reason for hiding this comment

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

Sleep? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh......stupid mistake :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@adohe-zz adohe-zz changed the title [WIP] add journal support add journal support Sep 26, 2016
@Random-Liu
Copy link
Member

@adohe Thanks a lot! Will review soon.

Before that, it seems that there is something wrong with Godeps, the test is failing.

@adohe-zz
Copy link
Contributor Author

I will fix this after my training is over.

@Random-Liu
Copy link
Member

@adohe Friendly ping~ :)

@adohe-zz
Copy link
Contributor Author

adohe-zz commented Oct 7, 2016

@Random-Liu I just go back from my National Holiday, will fix this asap.

@googlebot
Copy link

CLAs look good, thanks!

@adohe-zz
Copy link
Contributor Author

@Random-Liu I just update the godep, but it seems still some problem:

vendor/github.com/coreos/go-systemd/sdjournal/journal.go:27:33: fatal error: systemd/sd-journal.h: No such file or directory

Seems there is no libsystemd development/headers files available in the system search path. Could you confirm this? From the build log, we are running tests with docker, I am afraid there is no libsystemd in the image.

@Random-Liu
Copy link
Member

@adohe Hm, let me take a look.

@adohe-zz
Copy link
Contributor Author

@Random-Liu maybe we can modify .travis.yml to specify the os type or even install this manually when run tests.

@adohe-zz
Copy link
Contributor Author

@Random-Liu The travis failed because of this:

E: Unable to locate package libsystemd-dev

and I just found this on stackoverflow

@adohe-zz
Copy link
Contributor Author

@Random-Liu Friendly ping :)

for {

Copy link
Member

Choose a reason for hiding this comment

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

Extra empty line.

}
if err == nil {
buffer.WriteString(line)
// trime `\n`
Copy link
Member

Choose a reason for hiding this comment

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

s/trime/trim

glog.Errorf("exiting kernel log watch with error: %v", err)
return
}
if line == "" {
Copy link
Member

Choose a reason for hiding this comment

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

I think once we read till EOF, we should wait.
And less indent is preferred.

If err == io.EOF {
    buffer.WriterString(line)
    time.Sleep(pollPeriod) // Please use a const number
    continue
}
// Parsing the log

return nil, fmt.Errorf("Error opening journal: %v", err)
}
if r == nil {
return nil, fmt.Errorf("Got a nil reader")
Copy link
Member

Choose a reason for hiding this comment

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

Error should start with small letter. got a nil reader and same with the errors above.


func tryJournal() (io.Reader, error) {
r, err := sdjournal.NewJournalReader(sdjournal.JournalReaderConfig{
NumFromTail: uint64(0),
Copy link
Member

Choose a reason for hiding this comment

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

Please pass Since timestamp instead of tail to journald. See the lookback option above.

@@ -17,15 +17,20 @@ limitations under the License.
package kernelmonitor

import (
"bufio"
Copy link
Member

Choose a reason for hiding this comment

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

fmt package is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added.

@Random-Liu
Copy link
Member

Random-Liu commented Oct 24, 2016

@adohe
It seems that the os travis running on doesn't have libsystemd-dev.
https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments

It seems that libsystemd-dev needs ubuntu >= 15.04.

May be you can try ubuntu 14.04 with:

sudo: required
dist: trusty

And install libsystemd-journal-dev instead?

@Random-Liu
Copy link
Member

@adohe And can we add a build tag for systemd? We may usually build on non-systemd machine.

// +build systemd

and

// +build !systemd

And use go build -tags systemd by default.

@adohe-zz
Copy link
Contributor Author

@Random-Liu Thanks for your kind review, I will update this when I get up.

@Random-Liu
Copy link
Member

Random-Liu commented Oct 26, 2016

@adohe I believe this time journal header file stuff is solved, but there is a real failure.

@adohe-zz
Copy link
Contributor Author

adohe-zz commented Oct 27, 2016

@Random-Liu yes, I am fixing this failure.

@Random-Liu
Copy link
Member

@adohe Hi, this coming week will be the last week before code freeze. We need this feature for 1.5. Do you have time to work on this?

If not, we can get your current code in in a harmless way, then I can continue your following work. :)

@adohe-zz
Copy link
Contributor Author

@Random-Liu sorry I just forget the timeline, I will fix this today. Really sorry about this

@Random-Liu
Copy link
Member

Random-Liu commented Oct 31, 2016

@adohe Never mind. Really appreciate your help~Thanks a lot!

@adohe-zz
Copy link
Contributor Author

@Random-Liu I just fixed the failed tests, I believe there are some strange part that you may want to take a look. I will refactor some code tomorrow morning, it's to late now, I must go to sleep.

@Random-Liu
Copy link
Member

@Random-Liu I just fixed the failed tests, I believe there are some strange part that you may want to take a look. I will refactor some code tomorrow morning, it's to late now, I must go to sleep.

Thanks! I don't quite understand your current fix in fact... Will review again after your cleanup. :)

@Random-Liu
Copy link
Member

@adohe I'll merge this first and I'll finish the following work.

@Random-Liu Random-Liu merged commit 077dafc into kubernetes:master Nov 3, 2016
@adohe-zz adohe-zz deleted the journald branch November 3, 2016 13:05
@Random-Liu Random-Liu mentioned this pull request Jan 7, 2017
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants