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

Provide a logrotate conf for subagent logs #254

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ function build_systemd() {
# TODO: Build sample config file
mkdir -p "$DESTDIR/$sysconfdir/google-cloud-ops-agent/"
cp "confgenerator/default-config.yaml" "$DESTDIR/$sysconfdir/google-cloud-ops-agent/config.yaml"
mkdir -p "$DESTDIR/$sysconfdir/logrotate.d"
cp "default-logrotate-conf" "$DESTDIR/$sysconfdir/logrotate.d/google-cloud-ops-agent"
yuryu marked this conversation as resolved.
Show resolved Hide resolved

# N.B. Don't include $DESTDIR itself in the tarball, since mktemp -d will create it mode 0700.
(cd "$DESTDIR" && tar -czf /tmp/google-cloud-ops-agent.tgz *)
9 changes: 9 additions & 0 deletions default-logrotate-conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/var/log/google-cloud-ops-agent/subagents/logging-module.log
{
rotate 4
yuryu marked this conversation as resolved.
Show resolved Hide resolved
weekly
missingok
notifempty
compress
delaycompress
}
2 changes: 2 additions & 0 deletions pkg/rpm/google-cloud-ops-agent.spec
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The Google Cloud Ops Agent collects metrics and logs from the system.
%define _prefix /opt/%{name}
%define _confdir /etc/%{name}
%define _subagentdir %{_prefix}/subagents
%define _logrotatedir /etc/logrotate.d

%prep

Expand All @@ -46,6 +47,7 @@ CODE_VERSION=%{version} BUILD_DISTRO=${build_distro#.} DESTDIR="%{buildroot}" ./
%{_prefix}/libexec/google_cloud_ops_agent_engine
%{_unitdir}/%{name}*
%{_unitdir}-preset/*-%{name}*
%{_logrotatedir}/google-cloud-ops-agent
yuryu marked this conversation as resolved.
Show resolved Hide resolved

%post
%systemd_post google-cloud-ops-agent.service
Expand Down