microsoft / omi

Open Management Infrastructure
Other
368 stars 116 forks source link

Add logrotate state file #629

Closed JumpingYang001 closed 5 years ago

JumpingYang001 commented 5 years ago

Fixes #626 , @Microsoft/omi-devs , could you help to review this PR? thanks.

We have verified on 4 platforms:

Client Selinux status
ost64-ct6-01 enabled
ost64-rh5-01 disabled
ost64-ub16-02 enabled
ost64-ub14-02 disabled

After fixes, the new log status file shows as below:

root@ost64-rh5-01  # cat /var/lib/omi-logrotate.status
logrotate state -- version 2
"/var/opt/omi/log/omiserver.log" 2019-5-4
"/var/opt/omi/log/omiagent.root.root.log" 2019-5-4
"/var/opt/omi/log/miclient.log" 2019-5-4
JumpingYang001 commented 5 years ago

Travis failed due to 2 tests failed(not cause by this PR) : 1.

  libtest_wsman.so:TestWsmanClient_ChunkedResponseRedirect...
test_wsmanredirect.cpp(69): 
    Assert: (r) == (MI_RESULT_OK)
        ()
test_wsmanredirect.cpp(166): 
    Assert: 0
        (--http_server_proc)
test_wsmanredirect.cpp(253): 
    Assert: i < 1000
        (Server did not start properly)
    [Failed]  libtest_wsman.so:TestWsmanClient_ChunkedResponseRedirect  1.0772
  1. test_httpclient.cpp(92): 
    Assert: MI_RESULT_OK == Http_New_Server( &s_http, 0, PORT, PORT + 1, __null, sslOptions, callbackOnNewConnection, callbackData, options)
        ()
              libtest_http.so:TestHttpClient_BasicOperations...
    test_httpclient.cpp(110): 
    Assert: MI_RESULT_OK == Http_Delete(s_http)
        ()
    [Error]   libtest_http.so:TestHttpClient_BasicOperations    0.000607
    test_httpclient.cpp(92): 
    Assert: MI_RESULT_OK == Http_New_Server( &s_http, 0, PORT, PORT + 1, __null, sslOptions, callbackOnNewConnection, callbackData, options)
        ()
              libtest_http.so:TestHttpClient_BasicHeadOperation...
    test_httpclient.cpp(110): 
    Assert: MI_RESULT_OK == Http_Delete(s_http)
        ()
    [Error]   libtest_http.so:TestHttpClient_BasicHeadOperation 0.000332
    test_httpclient.cpp(92): 
    Assert: MI_RESULT_OK == Http_New_Server( &s_http, 0, PORT, PORT + 1, __null, sslOptions, callbackOnNewConnection, callbackData, options)
        ()
              libtest_http.so:TestHttpClient_MissingCertificate_https...
    ./tools/make_tests.sh: line 40:  5880 Segmentation fault      (core dumped) $bindir/nits -file:$tmpdir/nitsargs.txt
    /home/travis/build/Microsoft/omi/Unix/build.mak:165: recipe for target 'tests' failed
JumpingYang001 commented 5 years ago

The travis issue is about PORT in https://github.com/Microsoft/omi/blob/b66f6468838c7074c2b3f03eb1344a5958e1aced/Unix/tests/http/test_httpclient.cpp#L43 and https://github.com/Microsoft/omi/blob/b66f6468838c7074c2b3f03eb1344a5958e1aced/Unix/tests/wsman/test_wsmanredirect.cpp#L39

It seems the port might take by Travis environment box, need to do some investigation.

JumpingYang001 commented 5 years ago

I checked the history Travis job, it shows Travis upgrade ub14 docker to ub16 docker.

old: https://travis-ci.org/Microsoft/omi/jobs/512919448

Runtime kernel version: 4.4.0-101-generic
travis-build version: d6b12fc73
Build image provisioning date and time
Tue Dec  5 19:58:13 UTC 2017
Operating System Details
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty
Cookbooks Version
7c2c6a6 https://github.com/travis-ci/travis-cookbooks/tree/7c2c6a6
git version
git version 2.15.1
bash version
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
gcc version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
docker version
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:42:38 2017
 OS/Arch:      linux/amd64
Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:41:20 2017
 OS/Arch:      linux/amd64
 Experimental: false

now: https://travis-ci.org/Microsoft/omi/jobs/528367028

Runtime kernel version: 4.15.0-1028-gcp
travis-build version: dc6d594ef
Build image provisioning date and time
Mon Mar 25 16:43:24 UTC 2019
Operating System Details
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:    16.04
Codename:   xenial
Systemd Version
systemd 229
Cookbooks Version
42e42e4 https://github.com/travis-ci/travis-cookbooks/tree/42e42e4
git version
git version 2.21.0
bash version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
gcc version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
docker version
Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:11:02 2018
 OS/Arch:           linux/amd64
 Experimental:      false
Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:09:05 2018
  OS/Arch:          linux/amd64
  Experimental:     false
JumpingYang001 commented 5 years ago

Not repro on local ub16, I would like to enable debug mode for travis temporary, but I don't have permission to do it.

docs: https://developer.travis-ci.com/resource/job#debug https://docs.travis-ci.com/user/running-build-in-debug-mode/#legacy-repositories

JumpingYang001 commented 5 years ago

Use Travis with Trusty: https://docs.travis-ci.com/user/reference/overview/#linux Fixed the issue, new Travis image seems has some issue for Xenial . according to If you’re trying to use sudo: false or dist: precise keys in your travis.yml, we recommend you switch to our current Xenial Linux infrastructure. https://docs.travis-ci.com/user/reference/xenial/ it is different with travis-ci.org and travis-ci.com

we are using travis-ci.org

sarojcare commented 5 years ago

Make similar changes in SCX as well.

JumpingYang001 commented 5 years ago

@sarojcare how about use /var/opt/omi/log/omi-logrotate.status or /opt/omi/lib/omi-logrotate.status, which one is better?

JumpingYang001 commented 5 years ago

@sarojcare verified on 4 platforms again, and manually tested pass, could you help to signoff now? thanks.

JumpingYang001 commented 5 years ago

@sarojcare could you help to review and sign-off now? thanks.