| 142 | } |
| 143 | |
| 144 | func handleValidationError(resp *http.Response, log *zerolog.Logger) { |
| 145 | if resp.StatusCode == 530 { |
| 146 | log.Error().Msgf("no cloudflared connector available or reachable via management request (a recent version of cloudflared is required to use streaming logs)") |
| 147 | } |
| 148 | var managementErr managementErrorResponse |
| 149 | err := json.NewDecoder(resp.Body).Decode(&managementErr) |
| 150 | if err != nil { |
| 151 | log.Error().Msgf("unable to start management log streaming session: http response code returned %d", resp.StatusCode) |
| 152 | return |
| 153 | } |
| 154 | if managementErr.Success || len(managementErr.Errors) == 0 { |
| 155 | log.Error().Msgf("management tunnel validation returned success with invalid HTTP response code to convert to a WebSocket request") |
| 156 | return |
| 157 | } |
| 158 | for _, e := range managementErr.Errors { |
| 159 | log.Error().Msgf("management request failed validation: (%d) %s", e.Code, e.Message) |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | // parseFilters will attempt to parse provided filters to send to with the EventStartStreaming |
| 164 | func parseFilters(c *cli.Context) (*management.StreamingFilters, error) { |