Troubleshooting Zincobserve Upload Error

TLDR Simon encountered a 500 error when uploading logs to Zincobserve. Hengfei suggested using `--data-binary "@demo.log"` instead of `-d`, which resolved the issue.

Photo of Simon
Simon
Fri, 26 May 2023 09:49:15 UTC

hi, I installed zincobserve by docker in local. then: `curl -i -u email:pwd -d @notice.log` upload my multi line JSON logs. but reponse error: ```HTTP/1.1 500 Internal Server Error content-length: 40 vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers content-type: text/plain; charset=utf-8 date: Fri, 26 May 2023 09:16:31 GMT trailing characters at line 1 column 351```

Photo of Hengfei
Hengfei
Fri, 26 May 2023 10:00:57 UTC

What is your notice.log format?

Photo of Hengfei
Hengfei
Fri, 26 May 2023 10:01:13 UTC

Photo of Simon
Simon
Mon, 29 May 2023 02:40:31 UTC

a app log file, multiple json lines, such as : ```{"app": "order", "msg": "some msg"} {"app": "order", "msg": "some msg 2"}```

Photo of Hengfei
Hengfei
Mon, 29 May 2023 03:02:17 UTC

try this: ``` curl -i -u email:pwd --data-binary "@k8slog_json.json"```

Photo of Simon
Simon
Mon, 29 May 2023 06:53:34 UTC

get new error: `invalid number at line 1 column 2`

Photo of Hengfei
Hengfei
Mon, 29 May 2023 06:54:36 UTC

i guess you file format not json line by line. maybe you file content is an array of json.

Photo of Hengfei
Hengfei
Mon, 29 May 2023 06:54:55 UTC

can you show some line of your file?

Photo of Simon
Simon
Mon, 29 May 2023 07:05:36 UTC

oo, It's real multi line json... there are lines in file head: ```{"time":1684922046,"type":"info","thread":"main","data":{},"msg":"start"} {"time":1684922046,"type":"info","thread":"main","data":{},"msg":"start ok"} {"time":1684922046,"type":"info","thread":"main","data":{},"msg":"app started"}```

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:12:00 UTC

No problem, but the error looks file format error.

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:12:09 UTC

Can you give the file to me, let me check.

Photo of Simon
Simon
Mon, 29 May 2023 07:37:38 UTC

hi, you can save provided JSON lines as `demo.log` i get same error:

Photo of Simon
Simon
Mon, 29 May 2023 07:39:16 UTC

zinc-observe version is v0.4.4

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:40:00 UTC

is my test, it is no problem. with your log contents.

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:43:19 UTC

okay

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:43:37 UTC

your curl command is wrong.

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:43:42 UTC

please use ```--data-binary "@demo.log"```

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:44:01 UTC

Photo of Simon
Simon
Mon, 29 May 2023 07:51:38 UTC

thanks hi, i tested, if use `-d "@demo.log"` will get error. mybe because my os is windows? shell is git bash ```inhere@inhere-win MINGW64 ~/Downloads/a $ curl -X 'POST' '' -H 'accept: application/json' -H 'Authorization: Basic some==' -H 'Content-Type: application/json' -d "@demo.log" trailing characters at line 1 column 74 inhere@inhere-win MINGW64 ~/Downloads/a $ curl -i -X 'POST' '' -H 'accept: application/json' -H 'Authorization: Basic aW4uNzk4QHFxLmNvbTpoaTEyMzQ1Ng==' -H 'Content-Type: application/json' -d '{"time":1684922046,"type":"info","thread":"main","data":{},"msg":"start"} {"time":1684922046,"type":"info","thread":"main","data":{},"msg":"start ok"} {"time":1684922046,"type":"info","thread":"main","data":{},"msg":"app started"}' HTTP/1.1 200 OK content-length: 68 content-type: application/json vary: Origin, Access-Control-Request-Method, Access-Control-Request-Headers date: Mon, 29 May 2023 07:46:10 GMT {"code":200,"status":[{"name":"default","successful":3,"failed":0}]}```

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:52:10 UTC

you can't use `-d`

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:52:25 UTC

the command `-d` must provide some data, not a file.

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:53:00 UTC

if you want to provide a file, please use ```--data-binary "@demo.log"```

Photo of Simon
Simon
Mon, 29 May 2023 07:53:18 UTC

:joy: ok, thanks you.

Photo of Hengfei
Hengfei
Mon, 29 May 2023 07:54:58 UTC

if you are in China, you can join our Wechat Group, thanks.

Photo of Simon
Simon
Mon, 29 May 2023 07:56:11 UTC

OK.