运维|devops|docker部署安装和部署openobserve 运维|devops|docker部署安装和部署openobserve部署openobservedocker指令部署(注意用户名和密码规则)访问数据采集Fluent Bit(Ubuntu)日志采集器配置启动采集器错误检查查看安装位置根据错误排查重新执行启动命令临时验证模拟应用端推日志脚本前台模式实时观察日志调整可运行的配置运维|devops|docker部署安装和部署openobserve部署openobservedocker指令部署(注意用户名和密码规则)sudo docker run -d \ --name openobserve \ -p 5080:5080 \ -v $PWD/data:/data \ -e ZO_ROOT_USER_EMAILadminexample.com \ -e ZO_ROOT_USER_PASSWORDYourPssw0rd#123 \ public.ecr.aws/zinclabs/openobserve:latest访问http://192.168.0.20:5080/web/数据采集Fluent Bit(Ubuntu)下载安装curl https://packages.fluentbit.io/fluentbit.key | gpg --dearmor /usr/share/keyrings/fluentbit-keyring.gpg查询系统代号lsb_release -sc添加APT软件源(CODENAME 为上面查询代号替换)echo deb [signed-by/usr/share/keyrings/fluentbit-keyring.gpg] https://packages.fluentbit.io/ubuntu/${CODENAME} ${CODENAME} main | sudo tee /etc/apt/sources.list.d/fluent-bit.list更新包和安装sudo apt-get update sudo apt-get install fluent-bit日志采集器配置配置文件位置/etc/fluent-bit/fluent-bit.conf详情如下[SERVICE] flush 1 daemon Off log_level info parsers_file parsers.conf plugins_file plugins.conf http_server Off http_listen 0.0.0.0 http_port 2020 storage.metrics on [INPUT] Name cpu Tag cpu.local interval_sec 1 [INPUT] Name tail Path /data/test/log/api-gateway.log Tag api-gateway Refresh_Interval 10 Read_from_Head true [INPUT] Name tail Path /data/test/log/core.log Tag core Refresh_Interval 10 Read_from_Head true [INPUT] Name tail Path /data/test/log/test-mqtt.log Tag test-mqtt Refresh_Interval 10 Read_from_Head true [OUTPUT] Name http Match * Host 192.168.0.20 Port 5080 URI /api/default/${TAG}/_json # 使用 ${TAG} 动态替换为日志的 Tag Format json HTTP_User adminexample.com HTTP_Passwd YourPssw0rd#123 Compress gzip启动采集器启动-- 启动服务 sudo systemctl start fluent-bit -- 设置开机自启 sudo systemctl enable fluent-bit检查运行状态sudo systemctl status fluent-bit错误检查通过如下命令查看失败原因sudo journalctl -u fluent-bit -n 50 --no-pager场景1rootzqa-virtual-machine:~# sudo systemctl status fluent-bit × fluent-bit.service - Fluent Bit Loaded: loaded (/lib/systemd/system/fluent-bit.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2026-07-06 10:00:51 CST; 15s ago Docs: https://docs.fluentbit.io/manual/ Main PID: 626756 (codeexited, status1/FAILURE) CPU: 15ms 7月 06 10:00:51 zqa-virtual-machine systemd[1]: fluent-bit.service: Scheduled restart job, restart counter is at 5. 7月 06 10:00:51 zqa-virtual-machine systemd[1]: Stopped Fluent Bit. 7月 06 10:00:51 zqa-virtual-machine systemd[1]: fluent-bit.service: Start request repeated too quickly. 7月 06 10:00:51 zqa-virtual-machine systemd[1]: fluent-bit.service: Failed with result exit-code. 7月 06 10:00:51 zqa-virtual-machine systemd[1]: Failed to start Fluent Bit.查看安装位置cat fluent-bit | grep ExecStart根据错误排查重新执行启动命令校验配置是否正确sudo /opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fluent-bit.conf --dry-run重启命令sudo systemctl restart fluent-bit临时验证模拟应用端推日志脚本curl -u adminexample.com:YourPssw0rd#123 \ -H Content-Type: application/json \ -X POST http://192.168.0.20:5080/api/default/api-gateway/_json \ -d [{test:hello}]前台模式实时观察日志/opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fluent-bit.conf -vv调整可运行的配置[SERVICE] flush 1 daemon Off log_level info parsers_file parsers.conf plugins_file plugins.conf http_server Off http_listen 0.0.0.0 http_port 2020 storage.metrics on [INPUT] Name cpu Tag cpu.local interval_sec 1 [INPUT] Name tail Path /data/test/log/*.log Tag raw Path_Key file_path Refresh_Interval 10 Read_from_Head true [FILTER] Name rewrite_tag Match raw Rule $file_path ^/data/test/log/([^/])\.log$ $1 false [OUTPUT] Name http Match * Host 192.168.0.20 Port 5080 URI /api/default/$TAG/_json Format json json_date_key timestamp json_date_format iso8601 HTTP_User adminexample.com HTTP_Passwd YourPssw0rd#123 header Content-Type application/json # Compress 参数已删除默认不压缩