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

Symlink from /opt/<component>/var/log to /var/log/<component>. #7999

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Updated the CacheGroups Traffic Portal page to use a more performant AG-Grid-based table.
- Updated Go version to 1.22.0
- [#7979](https://github.com/apache/trafficcontrol/pull/7979) *Traffic Router*, *Traffic Monitor*, *Traffic Stats*: Store logs in /var/log
- [#7999](https://github.com/apache/trafficcontrol/pull/7999) *Traffic Router*, *Traffic Monitor*, *Traffic Stats*: Symlink from /opt/<component>/var/log to /var/log/<component>. These symlinks are deprecated with the intent of removing them in ATC 9.0.0.
- [#7872](https://github.com/apache/trafficcontrol/issues/7872) *Traffic Router*: Updated Apache Tomcat from 9.0.43, 9.0.67, 9.0.83, and 9.0.86 to 9.0.87.

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions traffic_monitor/build/traffic_monitor.spec
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/backup
mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/static
mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/run
mkdir -p "${RPM_BUILD_ROOT}"/var/log/traffic_monitor
# TODO: The /opt/traffic_monitor/var/log symlink is deprecated and should be removed for ATC 9.0.0.
ln -s /var/log/traffic_monitor "${RPM_BUILD_ROOT}"/opt/traffic_monitor/var/log
Copy link
Contributor

Choose a reason for hiding this comment

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

Would a "ln -sf" be a more resilient option here?

Copy link
Member Author

Choose a reason for hiding this comment

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

If adding -f ever prevents an error on this line, it means that there was already some file that existed at ${RPM_BUILD_ROOT}/opt/traffic_monitor/var/log. We'd rather know that such a file exists than cover up the error, right?

mkdir -p "${RPM_BUILD_ROOT}"/etc/init.d
mkdir -p "${RPM_BUILD_ROOT}"/etc/logrotate.d

Expand Down Expand Up @@ -108,6 +110,8 @@ fi
%dir /opt/traffic_monitor/backup
%dir /opt/traffic_monitor/static
%dir /opt/traffic_monitor/var
# TODO: The /opt/traffic_monitor/var/log symlink is deprecated and should be removed for ATC 9.0.0.
/opt/traffic_monitor/var/log
zrhoffman marked this conversation as resolved.
Show resolved Hide resolved
%dir /var/log/traffic_monitor
%dir /opt/traffic_monitor/var/run

Expand Down
22 changes: 21 additions & 1 deletion traffic_router/build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.4</version>
<version>2.2.0</version>
<extensions>true</extensions>
<executions>
<execution>
Expand Down Expand Up @@ -167,6 +167,21 @@
<username>root</username>
<groupname>root</groupname>
</mapping>
<mapping>
<directory>${deploy.dir}/var</directory>
<filemode>755</filemode>
<username>root</username>
<groupname>root</groupname>
<sources>
<!-- TODO: The /opt/traffic_router/var/log symlink is deprecated and should be removed
for ATC 9.0.0. -->
<softLinkSource>
<destination>log</destination>
<location>/var/log/traffic_router</location>
<failIfLocationNotExists>false</failIfLocationNotExists>
</softLinkSource>
</sources>
</mapping>
<mapping>
<directory>${deploy.dir}/temp</directory>
<filemode>755</filemode>
Expand Down Expand Up @@ -248,6 +263,11 @@
</sources>
</mapping>
</mappings>
<installScriptlet>
<!-- TODO: The /opt/traffic_router/var/log symlink is deprecated and should be removed
for ATC 9.0.0. -->
<script>ln -s /var/log/traffic_router %{buildroot}${deploy.dir}/var/log</script>
</installScriptlet>
<requires>
<require>java-11-openjdk-headless</require>
<require>tzdata-java</require>
Expand Down
4 changes: 3 additions & 1 deletion traffic_router/tomcat-rpm/tomcat.spec
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ Built:@BUILT@
%build

%install
mkdir -p "${RPM_BUILD_ROOT}"/var/log/tomcat
install -d -m 755 ${RPM_BUILD_ROOT}/%{tomcat_home}/
rmdir logs
mkdir -p "${RPM_BUILD_ROOT}"/var/log/tomcat
cp -R * ${RPM_BUILD_ROOT}/%{tomcat_home}/
ln -s /var/log/tomcat "${RPM_BUILD_ROOT}"%{tomcat_home}/logs
Copy link
Contributor

Choose a reason for hiding this comment

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

Would a "ln -sf" be a more resilient option here?

Copy link
Member Author

Choose a reason for hiding this comment

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

If adding -f ever prevents an error on this line, it means that there was already some file that existed at ${RPM_BUILD_ROOT}/opt/traffic_stats/var/log. We'd rather know that such a file exists than cover up the error, right?


# Remove all webapps.
rm -rf ${RPM_BUILD_ROOT}/%{tomcat_home}/webapps/*
Expand Down
4 changes: 4 additions & 0 deletions traffic_stats/build/traffic_stats.spec
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_stats/backup
mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_stats/influxdb_tools
mkdir -p "${RPM_BUILD_ROOT}"/opt/traffic_stats/var/run
mkdir -p "${RPM_BUILD_ROOT}"/var/log/traffic_stats
# TODO: The /opt/traffic_stats/var/log symlink is deprecated and should be removed for ATC 9.0.0.
ln -s /var/log/traffic_stats "${RPM_BUILD_ROOT}"/opt/traffic_stats/var/log
mkdir -p "${RPM_BUILD_ROOT}"/etc/init.d
mkdir -p "${RPM_BUILD_ROOT}"/etc/logrotate.d
mkdir -p "${RPM_BUILD_ROOT}"/var/lib/grafana/plugins/trafficcontrol-scenes-app
Expand Down Expand Up @@ -129,6 +131,8 @@ fi
%dir /opt/traffic_stats/conf
%dir /opt/traffic_stats/backup
%dir /opt/traffic_stats/var
# TODO: The /opt/traffic_stats/var/log symlink is deprecated and should be removed for ATC 9.0.0.
/opt/traffic_stats/var/log
zrhoffman marked this conversation as resolved.
Show resolved Hide resolved
%dir /opt/traffic_stats/var/run
%dir /var/log/traffic_stats
%dir /var/lib/grafana/plugins/trafficcontrol-scenes-app
Expand Down
Loading