This is an automated email from the ASF dual-hosted git repository.

zrhoffman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 007c94aa23 Disable debug logging for tc-health-client (#7699)
007c94aa23 is described below

commit 007c94aa2316336e58b64f3217118d3eb1998502
Author: Fabi Dias <[email protected]>
AuthorDate: Wed Aug 9 14:28:51 2023 -0600

    Disable debug logging for tc-health-client (#7699)
    
    * manual debug instructions for prod and CDN-in-a-Box
    
    * disable debug, redirect to dev null unless manually enabled per readme 
instructions
---
 .../cdn-in-a-box/health/tc-health-client-ReadMe.md           |  8 ++++++++
 infrastructure/cdn-in-a-box/health/tc-health-client.service  |  2 +-
 tc-health-client/README.md                                   | 12 ++++++++++++
 tc-health-client/config/config.go                            |  6 +++---
 4 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/infrastructure/cdn-in-a-box/health/tc-health-client-ReadMe.md 
b/infrastructure/cdn-in-a-box/health/tc-health-client-ReadMe.md
index 231efbd096..04c3cf1a2f 100644
--- a/infrastructure/cdn-in-a-box/health/tc-health-client-ReadMe.md
+++ b/infrastructure/cdn-in-a-box/health/tc-health-client-ReadMe.md
@@ -23,6 +23,14 @@
 
 Build and run cdn-in-a-box `docker-compose -f docker-compose.yml -f 
docker-compose.expose-ports.yml up`, once up and running, using docker desktop, 
navigate to terminal tab of an edge or mid. cd into `/var/log/trafficcontrol` 
and run `tail -f tc-health-client.log`. Click on the `Open in external 
terminal` on upper right side and cd into `/usr/bin` and run 
`./tc-health-client`. Wait for the dispersion time to pass and then logs will 
start in the window where the tail command was ran. Afte [...]
 
+## Enable Debug instructions [Different from Production]
+
+Debug is currently going to `/dev/null` to avoid filling up the logs. However, 
it can be redirect to show in the logs when debugging is needed. Systemd 
doesn't work well in Docker. Therefore the debbuging can be enabled in 
CDN-in-a-Box with the following steps:
+
+If `tc-health-client` is already running `control + c` to stop it
+Then run `/usr/bin/tc-health-client -vvv` in the `external terminal` this 
enables debug messages
+Watch logs in the docker desktop tab where `tail -f tc-health-client.log` was 
ran
+
 ## Config files for Testing Only
 
 For testing only the `tc-health-client.json` are the settings used to run it 
locally and can be changed. If changed `purge` all containers and run 
`docker-compose -f docker-compose.yml -f docker-compose.expose-ports.yml up` in 
the `infrastructure/cdn-in-a-box/` folder. Same applies if the 
`tc-health-client.service` and `to-creds` files are changed. The 
`tc-health-client.service` is set for `Debug` mode with `vvv` which is 
different from Production which is `vv`.
diff --git a/infrastructure/cdn-in-a-box/health/tc-health-client.service 
b/infrastructure/cdn-in-a-box/health/tc-health-client.service
index 854075b0b6..e8868f8062 100644
--- a/infrastructure/cdn-in-a-box/health/tc-health-client.service
+++ b/infrastructure/cdn-in-a-box/health/tc-health-client.service
@@ -22,7 +22,7 @@ After=trafficserver.service
 Requires=trafficserver.service
 
 [Service]
-ExecStart=/usr/bin/tc-health-client -vvv
+ExecStart=/usr/bin/tc-health-client -vv
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=always
 RestartSec=5
diff --git a/tc-health-client/README.md b/tc-health-client/README.md
index 1b15c10e2f..55930fad7a 100644
--- a/tc-health-client/README.md
+++ b/tc-health-client/README.md
@@ -131,6 +131,18 @@ Sample configuarion file:
 
 The name of the CDN that the Traffic Server host is a member of.
 
+### Enable Debug instructions
+
+Debug is currently going to `/dev/null` to avoid filling up the logs. However, 
it can be redirect to show in the logs when debugging is needed. In the desired 
machine, please add a 3rd `v` to `tc-health-client.service` resulting in `-vvv` 
which enables debugging live to trobleshoot an issue and **change it back to 
`-vv` once debugging is no londer needed**. 
+
+Steps:
+Cd into `/usr/lib/systemd/system/`
+To edit run `sudo vi tc-health-client.service`
+Save and quit with `wq!`
+Reload with `sudo systemctl daemon-reload`
+Run `sudo systemctl stop tc-health-client` and wait for the next prompt to show
+Then run `sudo systemctl start tc-health-client`
+
 ### enable-active-markdowns
 
 When enabled, the client will actively mark down Traffic Server parents.
diff --git a/tc-health-client/config/config.go 
b/tc-health-client/config/config.go
index 5a210b1cfc..dc2f00c45e 100644
--- a/tc-health-client/config/config.go
+++ b/tc-health-client/config/config.go
@@ -229,10 +229,10 @@ func GetConfig() (*Cfg, error, bool) {
        var err error
        var configFile string
        var logLocationErr = log.LogLocationStderr
-       var logLocationDebug = log.LogLocationFile
+       var logLocationDebug = log.LogLocationNull
        var logLocationInfo = log.LogLocationFile
-       var logLocationWarn = log.LogLocationFile
-       var logLocationEvent = log.LogLocationFile
+       var logLocationWarn = log.LogLocationNull
+       var logLocationEvent = log.LogLocationNull
 
        configFilePtr := getopt.StringLong("config-file", 'f', 
DefaultConfigFile, "full path to the json config file")
        logdirPtr := getopt.StringLong("logging-dir", 'l', DefaultLogDirectory, 
"directory location for log files")

Reply via email to