On a 401, fix the token query parameter, it is either absent or wrong. On a 400, read the line breakdown: clean up malformed JSON lines, trim oversized lines past the length limit, and drop empty lines instead of resending the same batch. Keep batches under 10 MB to avoid 413s, and use the 200 responses as confirmation that the batch was received and validated.

Context: Logz.io HTTP shipping docs document the response codes that explain rejected batches. A 401 means the token query parameter is missing or invalid. A 400 returns a breakdown of malformedLines, successfulLines, oversizedLines, and emptyLogLines so you can see exactly which lines failed and why. A 413 means the request body exceeded 10 MB.