jpappa200 commented on code in PR #6960:
URL: https://github.com/apache/trafficcontrol/pull/6960#discussion_r927960316


##########
cache-config/t3c-apply/torequest/cmd.go:
##########
@@ -274,6 +275,36 @@ func sendUpdate(cfg config.Cfg, configApplyTime, 
revalApplyTime *time.Time, conf
        return nil
 }
 
+//doTail calls t3c-tail and will run a tail on the log file provided with 
string for a regex to
+//maatch on default is .* endMatch will make t3c-tail exit when a pattern is 
matched otherwise
+//a timeout in a given number of seconds will occur.
+func doTail(cfg config.Cfg, file string, logMatch string, endMatch string, 
timeoutSeconds int) error {
+       tailData := t3cutil.TailCfg{
+               File:     &file,
+               LogMatch: &logMatch,
+               EndMatch: &endMatch,
+               TimeOut:  &timeoutSeconds,
+       }
+       tailInput, err := json.Marshal(&tailData)
+       if err != nil {
+               return fmt.Errorf("error loading json input")
+       }
+       stdOut, stdErr, code := t3cutil.DoInput(tailInput, `t3c-tail`, "")
+       if code > 1 {
+               return fmt.Errorf("t3c-tail returned error code %v stdout '%v' 
stderr '%v'", code, string(stdOut), string(stdErr))
+       }
+       logSubApp(`t3c-tail`, stdErr)
+
+       stripDate := 
regexp.MustCompile(`\[\w{3}\s{1,2}\d{1,2}\s\d{2}:\d{2}:\d{2}\.\d{3}\]\s`)

Review Comment:
   Moved outside of func



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to