当前位置: 首页 > news >正文

【笔记】VictoriaLogs 单机版的测试

【笔记】VictoriaLogs 单机版的测试

作者:张富春(ahfuzhang),转载时请注明作者和引用链接,谢谢!

  • cnblogs博客
  • zhihu
  • Github
  • 公众号:一本正经的瞎扯

用 docker 启动服务

docker run -it --rm --name vlogs \--cpus=1 -m=512m \-e GOMAXPROCS=1 \-v ~/Downloads/temp/2025/VictoriaLogs/:/data/ \-p 9428:9428 \victoriametrics/victoria-logs:v1.38.0 \-storageDataPath=/data/

浏览器查看 web ui

http://127.0.0.1:9428/select/vmui/

写入数据

echo '{"_time":"","_msg":"this is log body","a":"stream field a","b":"stream field b","c":"stream field c","other_tag":"xxxx"}
{"_time":"","_msg":"this is log body 2","a":"stream field a","b":"stream field b","c":"stream field c","other_tag":"xxxx 2"}
' | curl -X POST -H 'Content-Type: application/stream+json' --data-binary @- \"http://127.0.0.1:9428/insert/jsonline?_time_field=_time&_msg_field=_msg&_stream_fields=a,b,c" -v