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

Conversation

zrhoffman
Copy link
Member

@zrhoffman zrhoffman commented Apr 25, 2024

This PR creates symlinks from /opt/<component>/var/log to /var/log/<component> for the log directories that were moved in #7979. This is useful if you have any code or configuration still referencing /opt/<component>/var/log, because it buys some time to change those references to /var/log/<component>, rather than requiring that everything is changed all at once, whenever you deploy #7979.

Because this is intended as a temporary measure, these symlinks are deprecated with the intent of removing them in ATC 9.0.0, assuming there is a release before then that does include the symlinks.


Which Traffic Control components are affected by this PR?

  • Traffic Monitor
  • Traffic Router
  • Traffic Stats

What is the best way to verify this PR?

Build and install the RPMs, verify the symlinks exist.

cd infrastructure/cdn-in-a-box
make traffic_monitor/traffic_monitor.rpm traffic_router/traffic_router.rpm traffic_router/tomcat.rpm traffic_stats/traffic_stats.rpm
docker-compose build trafficmonitor trafficrouter trafficstats
docker-compose run --rm --no-deps --entrypoint= trafficmonitor ls -l /opt/traffic_monitor/var
docker-compose run --rm --no-deps trafficrouter ls -l /opt/traffic_router/var
docker-compose run --rm --no-deps --entrypoint= trafficstats ls -l /opt/traffic_stats/var

PR submission checklist

These symlinks are deprecated with the intent of removing them in ATC 9.0.0.
@zrhoffman zrhoffman added Traffic Router related to Traffic Router Traffic Stats related to Traffic Stats Traffic Monitor related to Traffic Monitor logging related to logging infrastructure labels Apr 25, 2024
Copy link
Contributor

@kdamichie kdamichie left a comment

Choose a reason for hiding this comment

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

Few questions to be addressed

traffic_monitor/build/traffic_monitor.spec Show resolved Hide resolved
traffic_stats/build/traffic_stats.spec Show resolved Hide resolved
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?

@@ -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?

Copy link
Contributor

@kdamichie kdamichie left a comment

Choose a reason for hiding this comment

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

LGTM

@zrhoffman zrhoffman merged commit f843561 into apache:master Apr 26, 2024
17 checks passed
@zrhoffman zrhoffman deleted the logs-symlinks branch April 26, 2024 14:37
@zrhoffman zrhoffman added the medium impact impacts a significant portion of a CDN, or has the potential to do so label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging related to logging infrastructure medium impact impacts a significant portion of a CDN, or has the potential to do so Traffic Monitor related to Traffic Monitor Traffic Router related to Traffic Router Traffic Stats related to Traffic Stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants