Skip to content

[AGW][logrotate] fix logrotate config#7159

Merged
themarwhal merged 1 commit intomagma:masterfrom
talkhasib:logrotate
May 26, 2021
Merged

[AGW][logrotate] fix logrotate config#7159
themarwhal merged 1 commit intomagma:masterfrom
talkhasib:logrotate

Conversation

@talkhasib
Copy link
Copy Markdown
Contributor

@talkhasib talkhasib commented May 26, 2021

Signed-off-by: Tariq Al-Khasib [email protected]

Summary

syslog log rotation is broken for Ubuntu. On the first log rotation, syslog gets empty and all logs are redirected to syslog.1

This PR forces a restart of rsyslog post rotation. This was tested and achieves the desirable behaviour on Ubuntu.
This PR also changes the syslog rotation config to "daily" since the logrotate cron job is run daily anyways.

Test Plan

Configuration changes tested on lab Ubuntu AGW.

@talkhasib talkhasib requested a review from a team as a code owner May 26, 2021 05:56
@talkhasib talkhasib requested a review from koolzz May 26, 2021 05:56
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines. label May 26, 2021
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for opening a PR! 💯 Please note that all commits must be signed off. This is enforced by the DCO check.

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

@magmabot magmabot added the component: agw Access gateway-related issue label May 26, 2021
@codecov
Copy link
Copy Markdown

codecov bot commented May 26, 2021

Codecov Report

Merging #7159 (8647d46) into master (dddf2aa) will increase coverage by 0.00%.
The diff coverage is n/a.

❗ Current head 8647d46 differs from pull request most recent head 26202f5. Consider uploading reports for the commit 26202f5 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7159   +/-   ##
=======================================
  Coverage   34.15%   34.15%           
=======================================
  Files        1163     1163           
  Lines      104564   104564           
  Branches     1321     1321           
=======================================
+ Hits        35713    35715    +2     
+ Misses      65433    65431    -2     
  Partials     3418     3418           
Flag Coverage Δ
c_cpp 9.82% <ø> (ø)
cloud_lint 65.77% <ø> (ø)
feg-lint 56.26% <ø> (+0.01%) ⬆️
lte-test 72.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
feg/gateway/policydb/streamer.go 47.82% <0.00%> (+8.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dddf2aa...26202f5. Read the comment docs.

@themarwhal themarwhal added the apply-v1.5 Apply this commit to the v1.5 release branch as well. label May 26, 2021
@themarwhal
Copy link
Copy Markdown
Member

Any idea what this comment # Restart rsyslog to pick up fluent-bit config means?

$(glob_files "${ANSIBLE_FILES}/envoy.yaml" /var/opt/magma/ ) \
$(glob_files "${ANSIBLE_FILES}/logrotate_oai.conf" /etc/logrotate.d/oai) \
$(glob_files "${ANSIBLE_FILES}/logrotate_rsyslog.conf" /etc/logrotate.d/rsyslog.magma) \
$(glob_files "${ANSIBLE_FILES}/logrotate_rsyslog.conf" /etc/logrotate.d/rsyslog) \
Copy link
Copy Markdown
Contributor

@pshelar pshelar May 26, 2021

Choose a reason for hiding this comment

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

I got following error after building package with this patch and deploying it.
sharing '/etc/logrotate.d/rsyslog' between multiple packages results in conflict. we shld avoid it.
the .magma file trick try to do it.

apt install magma=1.6.0-1622011168-f23096de
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libnetplan0 linux-headers-5.4.0-70 linux-headers-5.4.0-70-generic linux-headers-5.4.0-71 linux-headers-5.4.0-71-generic linux-image-5.4.0-70-generic linux-image-5.4.0-71-generic linux-modules-5.4.0-70-generic
  linux-modules-5.4.0-71-generic linux-modules-extra-5.4.0-70-generic linux-modules-extra-5.4.0-71-generic
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
  magma
1 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
Need to get 84.3 MB of archives.
After this operation, 24.1 MB of additional disk space will be used.
Get:1 https://artifactory.magmacore.org/artifactory/debian-test focal-1.5.0/main amd64 magma amd64 1.6.0-1622011168-f23096de [84.3 MB]
Fetched 84.3 MB in 7s (12.8 MB/s)
(Reading database ... 219323 files and directories currently installed.)
Preparing to unpack .../magma_1.6.0-1622011168-f23096de_amd64.deb ...
Unpacking magma (1.6.0-1622011168-f23096de) over (1.5.0-1621958919-c177d622) ...
dpkg: error processing archive /var/cache/apt/archives/magma_1.6.0-1622011168-f23096de_amd64.deb (--unpack):
 trying to overwrite '/etc/logrotate.d/rsyslog', which is also in package rsyslog 8.2001.0-1ubuntu1.1
Synchronizing state of redis-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable redis-server
Synchronizing state of dnsmasq.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable dnsmasq
Synchronizing state of lighttpd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable lighttpd
cp: cannot stat '/etc/logrotate.d/rsyslog.magma': No such file or directory
Errors were encountered while processing:
 /var/cache/apt/archives/magma_1.6.0-1622011168-f23096de_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, let me put that twisted logic back in. It did not feel right from the looks of it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we can have the .magma file in '/var/opt/magma/' to avoid confusion in log-rotate config.

@talkhasib
Copy link
Copy Markdown
Contributor Author

Any idea what this comment # Restart rsyslog to pick up fluent-bit config means?

The fluent-bit log rotation config gets added during the install process. This makes sure the config is picked up.

@pull-request-size pull-request-size bot added size/XS Denotes a PR that changes 0-9 lines. and removed size/S Denotes a PR that changes 10-29 lines. labels May 26, 2021
@talkhasib talkhasib added the ready2merge This PR is ready to be merged (is approved and passes all required checks) label May 26, 2021
Copy link
Copy Markdown
Contributor

@pshelar pshelar left a comment

Choose a reason for hiding this comment

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

LGTM

@themarwhal themarwhal merged commit 081c734 into magma:master May 26, 2021
rmeleromira pushed a commit to rmeleromira/magma that referenced this pull request Jul 24, 2021
m-trojanowski pushed a commit to openEPC/magma that referenced this pull request Oct 20, 2021
m-trojanowski pushed a commit to openEPC/magma that referenced this pull request Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apply-v1.5 Apply this commit to the v1.5 release branch as well. backported-v1.5 component: agw Access gateway-related issue ready2merge This PR is ready to be merged (is approved and passes all required checks) size/XS Denotes a PR that changes 0-9 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants