func SendRequest(Bulk *Bulk) int {
    client := &http.Client{
        Timeout: time.Duration(time.Duration(HttpTimeout) * time.Second),
    }

    for Attempt := 1; uint(Attempt) <= HttpSendRetryCount; Attempt++ {
        DebugLogger.Println("About to send bulk to Coralogix server. Attempt number:", Attempt)

        response, err := client.Post(LogUrl, "application/json", bytes.NewBuffer(Bulk.ToJSON()))

        if err != nil {
            DebugLogger.Println("Can't execute HTTP request:", err)
            continue
        }

        if response.StatusCode != 200 {
            DebugLogger.Println("HTTP requests was failed with code:", response.StatusCode)
        } else {
            DebugLogger.Println("Successfully sent bulk to Coralogix server. Result is:", response.StatusCode)
            return response.StatusCode
        }

        time.Sleep(time.Duration(HttpSendRetryInterval) * time.Second)
    }

    return 0
}
// SendRequest send logs data to Coralogix server
SendRequest send logs data to Coralogix server
// SendRequest send logs data to Coralogix server
func SendRequest(Bulk *Bulk) int {
    client := &http.Client{
        Timeout: time.Duration(time.Duration(HttpTimeout) * time.Second),
    }
    for Attempt := 1; uint(Attempt) <= HttpSendRetryCount; Attempt++ {
        DebugLogger.Println("About to send bulk to Coralogix server. Attempt number:", Attempt)
        response, err := client.Post(LogUrl, "application/json", bytes.NewBuffer(Bulk.ToJSON()))
        if err != nil {
            DebugLogger.Println("Can't execute HTTP request:", err)
            continue
        }
        if response.StatusCode != 200 {
            DebugLogger.Println("HTTP requests was failed with code:", response.StatusCode)
        } else {
            DebugLogger.Println("Successfully sent bulk to Coralogix server. Result is:", response.StatusCode)
            return response.StatusCode
        }
        time.Sleep(time.Duration(HttpSendRetryInterval) * time.Second)
    }
    return 0
}
func SendRequest ( Bulk * Bulk ) int { client := & http . Client { Timeout : time . Duration ( time . Duration ( HttpTimeout ) * time . Second ) , } for Attempt := 1 ; uint ( Attempt ) <= HttpSendRetryCount ; Attempt ++ { DebugLogger . Println ( " " , Attempt ) response , err := client . Post ( LogUrl , " " , bytes . NewBuffer ( Bulk . ToJSON ( ) ) ) if err != nil { DebugLogger . Println ( " " , err ) continue } if response . StatusCode != 200 { DebugLogger . Println ( " " , response . StatusCode ) } else { DebugLogger . Println ( " " , response . StatusCode ) return response . StatusCode } time . Sleep ( time . Duration ( HttpSendRetryInterval ) * time . Second ) } return 0 }
SendRequest send logs data to Coralogix server
SendRequest send logs data to Coralogix server