1.将所有容器的输出路由到远程 rsyslog 服务器

        1.修改 rsyslog 配置文件/etc/rsyslog.conf, 从中找到 “# Provides UDP sysilog recepion"语句。并将该处的以下两行配置代码行首的“#”字符删除(取消注释)

[root@host1 ~]# vi /etc/rsyslog.conf
[root@host1 ~]# cat /etc/rsyslog.conf
# rsyslog configuration file# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# or latest version online at http://www.rsyslog.com/doc/rsyslog_conf.html 
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html#### GLOBAL DIRECTIVES ##### Where to place auxiliary files
global(workDirectory="/var/lib/rsyslog")# Use default timestamp format
module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat")#### MODULES ####module(load="imuxsock"   # provides support for local system logging (e.g. via logger command)SysSock.Use="off") # Turn off message reception via local log socket; # local messages are retrieved through imjournal now.
module(load="imjournal"     # provides access to the systemd journalUsePid="system" # PID nummber is retrieved as the ID of the process the journal entry originates fromFileCreateMode="0644" # Set the access permissions for the state fileStateFile="imjournal.state") # File to store the position in the journal
#module(load="imklog") # reads kernel messages (the same are read from journald)
#module(load="immark") # provides --MARK-- message capability# Include all config files in /etc/rsyslog.d/
include(file="/etc/rsyslog.d/*.conf" mode="optional")# Provides UDP syslog reception
# for parameters see http://www.rsyslog.com/doc/imudp.html
module(load="imudp") # needs to be done just once
input(type="imudp" port="514")# Provides TCP syslog reception
# for parameters see http://www.rsyslog.com/doc/imtcp.html
#module(load="imtcp") # needs to be done just once
#input(type="imtcp" port="514")#### RULES ##### Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.*                                                 /dev/console# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none                /var/log/messages# The authpriv file has restricted access.
authpriv.*                                              /var/log/secure# Log all the mail messages in one place.
mail.*                                                  -/var/log/maillog# Log cron stuff
cron.*                                                  /var/log/cron# Everybody gets emergency messages
*.emerg                                                 :omusrmsg:*# Save news errors of level crit and higher in a special file.
uucp,news.crit                                          /var/log/spooler# Save boot messages also to boot.log
local7.*                                                /var/log/boot.log# ### sample forwarding rule ###
#action(type="omfwd"  
# # An on-disk queue is created for this action. If the remote host is
# # down, messages are spooled to disk and sent when it is up again.
#queue.filename="fwdRule1"       # unique name prefix for spool files
#queue.maxdiskspace="1g"         # 1gb space limit (use as much as possible)
#queue.saveonshutdown="on"       # save messages to disk on shutdown
#queue.type="LinkedList"         # run asynchronously
#action.resumeRetryCount="-1"    # infinite retries if host is down
# # Remote Logging (we use TCP for reliable delivery)
# # remote_host is: name/ip, e.g. 192.168.0.1, port optional e.g. 10514
#Target="remote_host" Port="XXX" Protocol="tcp")

        2.保存该配置文件,执行 systemctl restart rsyslog 命令重启 rsyslog, 然后检查514端口是否
已开启

[root@host1 ~]# systemctl restart rsyslog
[root@host1 ~]# netstat -antup | grep 514
udp        0      0 0.0.0.0:514             0.0.0.0:*                           418069/rsyslogd     
udp6       0      0 :::514                  :::*                                418069/rsyslogd  

        3.启动Logspout 容器,将日志转发到 Docker 主机上的syslog日志系统中

[root@host1 ~]# docker run --rm --name="logspout" --volume=/var/run/docker.sock:/var/run/docker.sock 
gliderlabs/logspout syslog+udp://192.168.197.9:514
Unable to find image 'gliderlabs/logspout:latest' locally
latest: Pulling from gliderlabs/logspout
8572bc8fb8a3: Pull complete 
bd801371a862: Pull complete 
58100c398b34: Pull complete 
Digest: sha256:2d81c026e11ac67f7887029dbfd7d36ee986d946066b45c1dabd966278eb5681
Status: Downloaded newer image for gliderlabs/logspout:latest
2025/09/16 09:01:14 # logspout v3.2.14 by gliderlabs
2025/09/16 09:01:14 # adapters: udp multiline raw syslog tcp tls
2025/09/16 09:01:14 # options : 
2025/09/16 09:01:14 persist:/mnt/routes
2025/09/16 09:01:14 # jobs    : http[routes,health,logs]:80 pump routes
2025/09/16 09:01:14 # routes  :
#   ADAPTERADDRESSCONTAINERSSOURCESOPTIONS
#   syslog+udp192.168.197.9:514map[]

                接下来进行实际测试。

        4.打开另一个终端窗口(或者标签页,下同),执行tail-f/var/log/messages 命令使用 tail 工具实时监控系统日志文件/var/og/messages

[root@host1 ~]# tail -f /var/log/messages
Sep 16 17:01:14 host1 NetworkManager[1037]: <info>  [1758013274.5256] device (veth56301f4): carrier: link connected
Sep 16 17:01:14 host1 NetworkManager[1037]: <info>  [1758013274.5263] device (docker0): carrier: link connected
Sep 16 17:01:16 host1 avahi-daemon[1038]: Joining mDNS multicast group on interface veth56301f4.IPv6 with address fe80::f83d:e5ff:fed9:8a10.
Sep 16 17:01:16 host1 avahi-daemon[1038]: New relevant interface veth56301f4.IPv6 for mDNS.
Sep 16 17:01:16 host1 avahi-daemon[1038]: Registering new address record for fe80::f83d:e5ff:fed9:8a10 on veth56301f4.*.
Sep 16 17:02:24 host1 systemd-logind[1049]: New session 5 of user root.
Sep 16 17:02:24 host1 systemd[1]: Started Session 5 of User root.
Sep 16 17:02:25 host1 systemd[1]: Starting Hostname Service...
Sep 16 17:02:25 host1 systemd[1]: Started Hostname Service.
Sep 16 17:02:55 host1 systemd[1]: systemd-hostnamed.service: Deactivated successfully.

        5.再打开另一个终端窗口,执行以下命令启动一个Redis 容器

[root@host1 ~]# docker run --rm -d --name redis redis
638a1d615856362d3315b99e3d55d31ff8ac821376925c46ed88c8957fabd4b6

        6.回到 tail 工具监控窗口,会发现该窗口显示了该容器输出的日志信息

Sep 16 17:04:56 host1 systemd[1]: Started libcontainer container 638a1d615856362d3315b99e3d55d31ff8ac821376925c46ed88c8957fabd4b6.
Sep 16 09:04:57 638a1d615856 redis[508446] Starting Redis Server
Sep 16 09:04:57 638a1d615856 redis[508446] 1:C 16 Sep 2025 09:04:57.222 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
Sep 16 09:04:57 638a1d615856 redis[508446] 1:C 16 Sep 2025 09:04:57.222 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
Sep 16 09:04:57 638a1d615856 redis[508446] 1:C 16 Sep 2025 09:04:57.223 * Redis version=8.2.1, bits=64, commit=00000000, modified=1, pid=1, just started
Sep 16 09:04:57 638a1d615856 redis[508446] 1:C 16 Sep 2025 09:04:57.223 * Configuration loaded
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.223 * monotonic clock: POSIX clock_gettime
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.228 * Running mode=standalone, port=6379.
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.231 * <bf> RedisBloom version 8.2.0 (Git=unknown)
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> Registering configuration options: [
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> #011{ bf-error-rate       :      0.01 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> #011{ bf-initial-size     :       100 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> #011{ bf-expansion-factor :         2 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> #011{ cf-bucket-size      :         2 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> #011{ cf-initial-size     :      1024 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> #011{ cf-max-iterations   :        20 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> #011{ cf-expansion-factor :         1 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> #011{ cf-max-expansions   :        32 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * <bf> ]
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.232 * Module 'bf' loaded from /usr/local/lib/redis/modules//redisbloom.so
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.239 * <search> Redis version found by RedisSearch : 8.2.1 - oss
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.239 * <search> RediSearch version 8.2.1 (Git=dba8dd0)
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.239 * <search> Low level api version 1 initialized successfully
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.240 * <search> gc: ON, prefix min length: 2, min word length to stem: 4, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, max number of search results:  1000000, 
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.240 * <search> Initialized thread pools!
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.240 * <search> Disabled workers threadpool of size 0
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.240 * <search> Subscribe to config changes
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.240 * <search> Enabled role change notification
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.241 * <search> Cluster configuration: AUTO partitions, type: 0, coordinator timeout: 0ms
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.241 * <search> Register write commands
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.242 * Module 'search' loaded from /usr/local/lib/redis/modules//redisearch.so
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> RedisTimeSeries version 80200, git_sha=1439d4a439ca9c063e6ef124a510abff09a5d493
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> Redis version found by RedisTimeSeries : 8.2.1 - oss
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> Registering configuration options: [
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> #011{ ts-compaction-policy   :              }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> #011{ ts-num-threads         :            3 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> #011{ ts-retention-policy    :            0 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> #011{ ts-duplicate-policy    :        block }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> #011{ ts-chunk-size-bytes    :         4096 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> #011{ ts-encoding            :   compressed }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> #011{ ts-ignore-max-time-diff:            0 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> #011{ ts-ignore-max-val-diff :     0.000000 }
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> ]
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> Detected redis oss
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.243 * <timeseries> Enabled diskless replication
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.244 * Module 'timeseries' loaded from /usr/local/lib/redis/modules//redistimeseries.so
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.245 * <ReJSON> Created new data type 'ReJSON-RL'
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.245 * <ReJSON> version: 80200 git sha: unknown branch: unknown
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V1 API
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V2 API
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V3 API
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V4 API
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V5 API
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Enabled diskless replication
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Initialized shared string cache, thread safe: false.
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.246 * Module 'ReJSON' loaded from /usr/local/lib/redis/modules//rejson.so
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.246 * <search> Acquired RedisJSON_V5 API
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.247 * Server initialized
Sep 16 09:04:57 638a1d615856 redis[508446] 1:M 16 Sep 2025 09:04:57.247 * Ready to accept connections tcp
Sep 16 17:04:57 host1 kernel: docker0: port 2(veth98f6e8e) entered blocking state
Sep 16 17:04:57 host1 kernel: docker0: port 2(veth98f6e8e) entered disabled state
Sep 16 17:04:57 host1 kernel: veth98f6e8e: entered allmulticast mode
Sep 16 17:04:57 host1 kernel: veth98f6e8e: entered promiscuous mode
Sep 16 17:04:57 host1 NetworkManager[1037]: <info>  [1758013497.0074] manager: (veth98f6e8e): new Veth device (/org/freedesktop/NetworkManager/Devices/11)
Sep 16 17:04:57 host1 kernel: eth0: renamed from veth65d7b4f
Sep 16 17:04:57 host1 kernel: docker0: port 2(veth98f6e8e) entered blocking state
Sep 16 17:04:57 host1 kernel: docker0: port 2(veth98f6e8e) entered forwarding state
Sep 16 17:04:57 host1 NetworkManager[1037]: <info>  [1758013497.0394] device (veth98f6e8e): carrier: link connected
Sep 16 17:04:59 host1 avahi-daemon[1038]: Joining mDNS multicast group on interface veth98f6e8e.IPv6 with address fe80::88ee:d3ff:fee1:da20.
Sep 16 17:04:59 host1 avahi-daemon[1038]: New relevant interface veth98f6e8e.IPv6 for mDNS.
Sep 16 17:04:59 host1 avahi-daemon[1038]: Registering new address record for fe80::88ee:d3ff:fee1:da20 on veth98f6e8e.*.
Sep 16 17:05:15 host1 systemd[1]: Starting dnf makecache...
Sep 16 17:05:16 host1 dnf[516372]: CentOS Stream 9 - BaseOS (Aliyun)               5.3 kB/s | 3.9 kB     00:00
Sep 16 17:05:17 host1 dnf[516372]: CentOS Stream 9 - AppStream (Aliyun)            8.0 kB/s | 4.4 kB     00:00
Sep 16 17:05:18 host1 dnf[516372]: Docker CE Stable - x86_64                       3.8 kB/s | 2.0 kB     00:00
Sep 16 17:05:18 host1 dnf[516372]: 元数据缓存已建立。
Sep 16 17:05:18 host1 systemd[1]: dnf-makecache.service: Deactivated successfully.
Sep 16 17:05:18 host1 systemd[1]: Finished dnf makecache.
Sep 16 17:05:18 host1 systemd[1]: dnf-makecache.service: Consumed 1.607s CPU time.

        7.切换到另一个终端窗口,使用 docker logs 命令获取 Redis 容器的日志信息,会发现获取的日志信息与Logspout 容器收集到的完全一致

[root@host1 ~]# docker logs redis
Starting Redis Server
1:C 16 Sep 2025 09:04:57.222 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:C 16 Sep 2025 09:04:57.222 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 16 Sep 2025 09:04:57.223 * Redis version=8.2.1, bits=64, commit=00000000, modified=1, pid=1, just started
1:C 16 Sep 2025 09:04:57.223 * Configuration loaded
1:M 16 Sep 2025 09:04:57.223 * monotonic clock: POSIX clock_gettime
1:M 16 Sep 2025 09:04:57.228 * Running mode=standalone, port=6379.
1:M 16 Sep 2025 09:04:57.231 * <bf> RedisBloom version 8.2.0 (Git=unknown)
1:M 16 Sep 2025 09:04:57.232 * <bf> Registering configuration options: [
1:M 16 Sep 2025 09:04:57.232 * <bf> { bf-error-rate       :      0.01 }
1:M 16 Sep 2025 09:04:57.232 * <bf> { bf-initial-size     :       100 }
1:M 16 Sep 2025 09:04:57.232 * <bf> { bf-expansion-factor :         2 }
1:M 16 Sep 2025 09:04:57.232 * <bf> { cf-bucket-size      :         2 }
1:M 16 Sep 2025 09:04:57.232 * <bf> { cf-initial-size     :      1024 }
1:M 16 Sep 2025 09:04:57.232 * <bf> { cf-max-iterations   :        20 }
1:M 16 Sep 2025 09:04:57.232 * <bf> { cf-expansion-factor :         1 }
1:M 16 Sep 2025 09:04:57.232 * <bf> { cf-max-expansions   :        32 }
1:M 16 Sep 2025 09:04:57.232 * <bf> ]
1:M 16 Sep 2025 09:04:57.232 * Module 'bf' loaded from /usr/local/lib/redis/modules//redisbloom.so
1:M 16 Sep 2025 09:04:57.239 * <search> Redis version found by RedisSearch : 8.2.1 - oss
1:M 16 Sep 2025 09:04:57.239 * <search> RediSearch version 8.2.1 (Git=dba8dd0)
1:M 16 Sep 2025 09:04:57.239 * <search> Low level api version 1 initialized successfully
1:M 16 Sep 2025 09:04:57.240 * <search> gc: ON, prefix min length: 2, min word length to stem: 4, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, max number of search results:  1000000, 
1:M 16 Sep 2025 09:04:57.240 * <search> Initialized thread pools!
1:M 16 Sep 2025 09:04:57.240 * <search> Disabled workers threadpool of size 0
1:M 16 Sep 2025 09:04:57.240 * <search> Subscribe to config changes
1:M 16 Sep 2025 09:04:57.240 * <search> Enabled role change notification
1:M 16 Sep 2025 09:04:57.241 * <search> Cluster configuration: AUTO partitions, type: 0, coordinator timeout: 0ms
1:M 16 Sep 2025 09:04:57.241 * <search> Register write commands
1:M 16 Sep 2025 09:04:57.242 * Module 'search' loaded from /usr/local/lib/redis/modules//redisearch.so
1:M 16 Sep 2025 09:04:57.243 * <timeseries> RedisTimeSeries version 80200, git_sha=1439d4a439ca9c063e6ef124a510abff09a5d493
1:M 16 Sep 2025 09:04:57.243 * <timeseries> Redis version found by RedisTimeSeries : 8.2.1 - oss
1:M 16 Sep 2025 09:04:57.243 * <timeseries> Registering configuration options: [
1:M 16 Sep 2025 09:04:57.243 * <timeseries> { ts-compaction-policy   :              }
1:M 16 Sep 2025 09:04:57.243 * <timeseries> { ts-num-threads         :            3 }
1:M 16 Sep 2025 09:04:57.243 * <timeseries> { ts-retention-policy    :            0 }
1:M 16 Sep 2025 09:04:57.243 * <timeseries> { ts-duplicate-policy    :        block }
1:M 16 Sep 2025 09:04:57.243 * <timeseries> { ts-chunk-size-bytes    :         4096 }
1:M 16 Sep 2025 09:04:57.243 * <timeseries> { ts-encoding            :   compressed }
1:M 16 Sep 2025 09:04:57.243 * <timeseries> { ts-ignore-max-time-diff:            0 }
1:M 16 Sep 2025 09:04:57.243 * <timeseries> { ts-ignore-max-val-diff :     0.000000 }
1:M 16 Sep 2025 09:04:57.243 * <timeseries> ]
1:M 16 Sep 2025 09:04:57.243 * <timeseries> Detected redis oss
1:M 16 Sep 2025 09:04:57.243 * <timeseries> Enabled diskless replication
1:M 16 Sep 2025 09:04:57.244 * Module 'timeseries' loaded from /usr/local/lib/redis/modules//redistimeseries.so
1:M 16 Sep 2025 09:04:57.245 * <ReJSON> Created new data type 'ReJSON-RL'
1:M 16 Sep 2025 09:04:57.245 * <ReJSON> version: 80200 git sha: unknown branch: unknown
1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V1 API
1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V2 API
1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V3 API
1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V4 API
1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Exported RedisJSON_V5 API
1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Enabled diskless replication
1:M 16 Sep 2025 09:04:57.246 * <ReJSON> Initialized shared string cache, thread safe: false.
1:M 16 Sep 2025 09:04:57.246 * Module 'ReJSON' loaded from /usr/local/lib/redis/modules//rejson.so
1:M 16 Sep 2025 09:04:57.246 * <search> Acquired RedisJSON_V5 API
1:M 16 Sep 2025 09:04:57.247 * Server initialized
1:M 16 Sep 2025 09:04:57.247 * Ready to accept connections tcp

        8.实验完毕,停止 Redis 容器和 Logspout 容器(切换该容器运行的终端窗口,按CultC组合键),它们会被自动删除。

[root@host1 ~]# docker stop redis  
redis
[root@host1 ~]# docker stop logspout
Error response from daemon: No such container: logspout
[root@host1 ~]# docker ps -a
CONTAINER ID   IMAGE                          COMMAND                   CREATED        STATUS                      PORTS                                     NAMES
96632885a463   lagoudocker/cadvisor:v0.37.0   "/usr/bin/cadvisor -…"   18 hours ago   Exited (0) 18 hours ago                                               cadvisor-stdout
62b9981bf08e   php-nginx-supervisor:v1        "/usr/bin/supervisor…"   30 hours ago   Exited (255) 27 hours ago   0.0.0.0:8080->80/tcp, [::]:8080->80/tcp   php-web-app
7ecac05c7dac   centos-with-nginx:1.0          "nginx -g 'daemon of…"   5 days ago     Exited (255) 4 days ago     0.0.0.0:8080->80/tcp, [::]:8080->80/tcp   test-nginx
0dbf7ea2178e   registry                       "/entrypoint.sh /etc…"   6 days ago     Exited (2) 39 minutes ago                                             myregistry
c8efe28b118e   busybox                        "sh"                      6 days ago     Exited (137) 6 days ago                                               stoic_raman
65a371a8cacb   httpd                          "httpd-foreground"        6 days ago     Exited (0) 6 days ago                                                 testweb
7ab5ac9bc007   ubuntu                         "/bin/bash"               6 days ago     Exited (0) 6 days ago                                                 inspiring_joliot
b97f426e8369   ubuntu                         "/bin/echo"               6 days ago     Exited (0) 6 days ago                                                 friendly_chaplygin
9ac8245b5b08   img-layers-test                "python /app/app.py"      8 days ago     Exited (0) 8 days ago                                                 crazy_kowalevski
49e91767b48d   ubuntu                         "/bin/bash"               8 days ago     Exited (0) 8 days ago                                                 frosty_lichterman
38b001022f7a   hello-world                    "/hello"                  8 days ago     Exited (0) 8 days ago                                                 intelligent_brahmagupta
[root@host1 ~]# 

2.通过 HTTP 查看 Logspout 收集的日志

        1.只需读取 HTTP数据流,即可实时查看生成的聚合日志。可以使用 Logspout 的 HTTP流模块,实时查看由它聚合的本地日志,而不用提供日志路由的URI,如执行以下操作:

[root@host1 ~]# docker run --rm -d --name="logspout" \--volume /var/run/docker.sock:/var/run/docker.sock \--publish=127.0.0.1:8000:80 \gliderlabs/logspout
cfd9130ed802c6d28dd2e67f85899510016d9f423586802bc6a6d447bd727e4a

        2.使用 curl 观察容器的日志流

[root@host1 ~]# curl http://127.0.0.1:8000/logs

        3.打开另一个终端窗口,执行容器操作。这里启动 Redis 容器,切回前面的终端窗口,会发现关于 Redis 容器启动的日志流,如下所示

[root@host1 ~]# curl http://127.0.0.1:8000/logsredis|Starting Redis Serverredis|1:C 16 Sep 2025 14:32:02.923 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.redis|1:C 16 Sep 2025 14:32:02.924 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Ooredis|1:C 16 Sep 2025 14:32:02.924 * Redis version=8.2.1, bits=64, commit=00000000, modified=1, pid=1, just startedredis|1:C 16 Sep 2025 14:32:02.924 * Configuration loadedredis|1:M 16 Sep 2025 14:32:02.925 * monotonic clock: POSIX clock_gettimeredis|1:M 16 Sep 2025 14:32:02.926 * Running mode=standalone, port=6379.redis|1:M 16 Sep 2025 14:32:02.927 * <bf> RedisBloom version 8.2.0 (Git=unknown)redis|1:M 16 Sep 2025 14:32:02.927 * <bf> Registering configuration options: [redis|1:M 16 Sep 2025 14:32:02.927 * <bf> { bf-error-rate       :      0.01 }redis|1:M 16 Sep 2025 14:32:02.927 * <bf> { bf-initial-size     :       100 }redis|1:M 16 Sep 2025 14:32:02.927 * <bf> { bf-expansion-factor :         2 }redis|1:M 16 Sep 2025 14:32:02.927 * <bf> { cf-bucket-size      :         2 }redis|1:M 16 Sep 2025 14:32:02.927 * <bf> { cf-initial-size     :      1024 }redis|1:M 16 Sep 2025 14:32:02.927 * <bf> { cf-max-iterations   :        20 }redis|1:M 16 Sep 2025 14:32:02.927 * <bf> { cf-expansion-factor :         1 }redis|1:M 16 Sep 2025 14:32:02.927 * <bf> { cf-max-expansions   :        32 }redis|1:M 16 Sep 2025 14:32:02.927 * <bf> ]redis|1:M 16 Sep 2025 14:32:02.927 * Module 'bf' loaded from /usr/local/lib/redis/modules//redisbloom.soredis|1:M 16 Sep 2025 14:32:02.932 * <search> Redis version found by RedisSearch : 8.2.1 - ossredis|1:M 16 Sep 2025 14:32:02.932 * <search> RediSearch version 8.2.1 (Git=dba8dd0)redis|1:M 16 Sep 2025 14:32:02.933 * <search> Low level api version 1 initialized successfullyredis|1:M 16 Sep 2025 14:32:02.933 * <search> gc: ON, prefix min length: 2, min word length to stem: 4, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, max number of search results:  1000000, redis|1:M 16 Sep 2025 14:32:02.933 * <search> Initialized thread pools!redis|1:M 16 Sep 2025 14:32:02.933 * <search> Disabled workers threadpool of size 0redis|1:M 16 Sep 2025 14:32:02.933 * <search> Subscribe to config changesredis|1:M 16 Sep 2025 14:32:02.933 * <search> Enabled role change notificationredis|1:M 16 Sep 2025 14:32:02.933 * <search> Cluster configuration: AUTO partitions, type: 0, coordinator timeout: 0msredis|1:M 16 Sep 2025 14:32:02.933 * <search> Register write commandsredis|1:M 16 Sep 2025 14:32:02.933 * Module 'search' loaded from /usr/local/lib/redis/modules//redisearch.soredis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> RedisTimeSeries version 80200, git_sha=1439d4a439ca9c063e6ef124a510abff09a5d493redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> Redis version found by RedisTimeSeries : 8.2.1 - ossredis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> Registering configuration options: [redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> { ts-compaction-policy   :              }redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> { ts-num-threads         :            3 }redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> { ts-retention-policy    :            0 }redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> { ts-duplicate-policy    :        block }redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> { ts-chunk-size-bytes    :         4096 }redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> { ts-encoding            :   compressed }redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> { ts-ignore-max-time-diff:            0 }redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> { ts-ignore-max-val-diff :     0.000000 }redis|1:M 16 Sep 2025 14:32:02.934 * <timeseries> ]redis|1:M 16 Sep 2025 14:32:02.935 * <timeseries> Detected redis ossredis|1:M 16 Sep 2025 14:32:02.935 * <timeseries> Enabled diskless replicationredis|1:M 16 Sep 2025 14:32:02.935 * Module 'timeseries' loaded from /usr/local/lib/redis/modules//redistimeseries.soredis|1:M 16 Sep 2025 14:32:02.936 * <ReJSON> Created new data type 'ReJSON-RL'redis|1:M 16 Sep 2025 14:32:02.936 * <ReJSON> version: 80200 git sha: unknown branch: unknownredis|1:M 16 Sep 2025 14:32:02.936 * <ReJSON> Exported RedisJSON_V1 APIredis|1:M 16 Sep 2025 14:32:02.936 * <ReJSON> Exported RedisJSON_V2 APIredis|1:M 16 Sep 2025 14:32:02.936 * <ReJSON> Exported RedisJSON_V3 APIredis|1:M 16 Sep 2025 14:32:02.936 * <ReJSON> Exported RedisJSON_V4 APIredis|1:M 16 Sep 2025 14:32:02.936 * <ReJSON> Exported RedisJSON_V5 APIredis|1:M 16 Sep 2025 14:32:02.936 * <ReJSON> Enabled diskless replicationredis|1:M 16 Sep 2025 14:32:02.936 * <ReJSON> Initialized shared string cache, thread safe: false.redis|1:M 16 Sep 2025 14:32:02.936 * Module 'ReJSON' loaded from /usr/local/lib/redis/modules//rejson.soredis|1:M 16 Sep 2025 14:32:02.936 * <search> Acquired RedisJSON_V5 APIredis|1:M 16 Sep 2025 14:32:02.937 * Server initializedredis|1:M 16 Sep 2025 14:32:02.937 * Ready to accept connections tcp
[root@host1 ~]# curl http://127.0.0.1:8000/logsredis|1:signal-handler (1758033244) Received SIGTERM scheduling shutdown...redis|1:M 16 Sep 2025 14:34:04.256 * User requested shutdown...redis|1:M 16 Sep 2025 14:34:04.256 * Saving the final RDB snapshot before exiting.redis|1:M 16 Sep 2025 14:34:04.259 * DB saved on diskredis|1:M 16 Sep 2025 14:34:04.259 # Redis is now ready to exit, bye bye...
^C

        如果收集到多个容器的日志,则将以不同颜色显示不同容器的日志。

        4.实验完毕,停止Redis 容器和 Logspout容器,它们会被自动删除。

[root@host1 ~]# docker stop redis
redis

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/web/97989.shtml
繁体地址,请注明出处:http://hk.pswp.cn/web/97989.shtml
英文地址,请注明出处:http://en.pswp.cn/web/97989.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【智能化解决方案】基于多目标优化检索增强生成的智能行程规划方案

&#x1f4dd; 基于多目标优化的智能行程规划方案 1 用户需求分析与矩阵构建 1.1 核心用户信息提取 根据用户提供的年龄、出发地、目的地、出行时间等基本信息&#xff0c;我们首先构建一个用户特征向量&#xff1a; U {Age, Origin, Destination, TravelDate, Duration, Budg…

软件研发的演变

软件研发从一门手工作坊式的艺术&#xff0c;逐步演进为一门系统化、工程化、智能化的现代学科。其发展历程不仅体现了技术的飞跃&#xff0c;更反映了方法论、协作模式和思维方式的深刻变革。一、发展演变历程软件研发的演变可以大致划分为以下几个阶段&#xff1a;1. 软件作坊…

「日拱一码」091 机器学习——集成学习

目录 集成学习介绍 1. 核心思想 2. 为什么有效&#xff1f; 3. 主要流派与方法 A. 并行方法&#xff1a;Bagging (Bootstrap Aggregating) B. 串行方法&#xff1a;Boosting C. 堆叠法&#xff1a;Stacking 代码示例 Bagging 的代表 —— 随机森林 (Random Forest) 集成…

vscode实现第三方包的使用,cmake结合vcpkg(跨平台)

要使用cmake和vcpkg组织一个完整的现代cpp项目&#xff0c;一般来说需要三个文件vcpkg.json描述第三方依赖项//vcpkg.json {"dependencies": ["fmt"] }//安装,在vcpkg.json目录执行 vcpkg installCMakePresets.json定义项目的本质属性&#xff08;What&…

DevExpress中Word Processing Document API学习记录

文章目录1 文档结构划分2 文档操作基础2.1 Positions and Ranges2.2 Secitions2.3 Paragraphs2.4 Tables2.5 Lists2.6 Hyperlinks and Bookmarks2.7 Comments2.8 Headers and Footers2.9 Shapes and Pictures2.10 Watermarks2.11 Charts2.12 OLE Objects2.13 ActiveX Controls2…

Roo Code 的差异_快速编辑功能

什么是差异编辑&#xff1f; 简单来说&#xff0c;差异编辑就像是一位细心的装修师傅&#xff1a;他不会把整个房子拆掉重盖&#xff0c;而是精准地只修补需要改动的部分。Roo Code 的这项功能默认开启&#xff0c;它通过比对代码差异&#xff08;diff&#xff09;来实施修改&a…

【Axure高保真原型】标签树分类查询案例

今天和大家分享标签树分类查询案例的原型模版&#xff0c;效果包括&#xff1a; 树形分类——点击左侧树形里的箭头&#xff0c;可以展开或收起子级选项&#xff1b; 查询表格——点击标签树里的选项&#xff0c;如果是末级选项&#xff0c;可以筛选右侧表格用户标签&#xf…

容器化部署项目05

一、工作原理 镜像&#xff1a;容器的模板&#xff0c;包括容器运行时所需的数据 容器&#xff1a;运行中的进程&#xff0c;依赖镜像运行&#xff0c;镜像的具现化 镜像你可以把它看成Python中的类&#xff0c;而容器可以看做是类的实例化对象。 一个类可以有多个对象&#xf…

微信小程序 工作日历 周计划日报 修改等提报和状态展示功能,支持h5,Android ,ios,基于uniapp,适配vue2和vue3

Work-calendar 介绍 &#xff08;底部附链接&#xff09; 基于uni-calendar做的定制化开发&#xff0c;主要功能为工作日历展示和提报组件 ​ 1.支持周计划日报状态展示且可配置 ​ 2.支持农历展示配置&#xff0c;回到当日&#xff0c;月份切换 ​ 3.日历&#xff0c;周报…

openharmony 鸿蒙 下 利用蓝牙API(a2dp模块-高级音频,ble模块-低功耗蓝牙等)完成对蓝牙音响的控制(蓝牙广播)

1.首先是登录页面&#xff08;利用webapi 和本地数据存储完成登陆操作&#xff09; 2.添加设备&#xff08;利用ble.startBLEScan 和 ble.on("BLEDeviceFind", onReceiveEvent);完成蓝牙扫描与显示&#xff09; 3.蓝牙ble连接&#xff08;利用ble.createGattClientDe…

17、逻辑回归与分类评估 - 从连续到离散的智能判断

学习目标:理解分类问题的本质和评估方法,掌握逻辑回归的数学原理和概率解释,学会二分类和多分类问题的处理方法,熟练使用分类评估指标,理解过拟合和正则化的基本概念。 > 从第16章到第17章:从预测数值到判断类别 在第16章中,我们学习了线性回归,解决的是预测连续数…

自动化脚本的核心引擎

自动化脚本作为现代软件开发与运维的重要工具&#xff0c;其核心引擎承担着解析指令、调度任务和执行逻辑的关键职能。这种引擎本质上是一个轻量级的运行时环境&#xff0c;通过预定义的规则集将人类可读的脚本语言转化为机器可执行的原子操作。在持续集成/持续交付&#xff08…

【Vue2 ✨】Vue2 入门之旅 · 进阶篇(九):Vue2 性能优化

在前几篇文章中&#xff0c;我们学习了 Vuex 的内部机制以及 Vue Router 的工作原理。本篇将深入探讨 Vue2 性能优化&#xff0c;帮助你掌握在开发中提升 Vue 应用性能的方法和技巧。 目录 性能优化的意义响应式系统优化虚拟 DOM 与渲染优化组件懒加载与按需渲染事件与计算属性…

【题解】B2600 【深基1.例2】简单的分苹果

题目描述 这里有 101010 个苹果&#xff0c;小 A 拿走了 222 个&#xff0c;Uim 拿走了 444 个&#xff0c;八尾勇拿走剩下的所有的苹果。我们想知道&#xff1a; 小A 和 Uim 两个人一共拿走多少苹果&#xff1f;八尾勇能拿走多少苹果&#xff1f; 现在需要编写一个程序&#x…

中小企业 4G 专网部署:性能与成本的最佳平衡

在数字化转型的浪潮中&#xff0c;中小企业同样需要安全、稳定和高效的通信网络。然而&#xff0c;传统专网的高成本和复杂部署往往成为阻碍。IPLOOK 提供的4G轻量级核心网与专网解决方案&#xff0c;正是帮助中小企业在性能与成本之间找到最佳平衡的关键。 中小企业的网络挑…

LeetCode每日一题,20250914

元音拼写检查器 思路 精确匹配 用 HashSet 保存原始单词&#xff0c;查询时直接判断是否存在。 大小写忽略匹配 用 HashMap<String, String> 保存 小写单词 -> 第一次出现的原始单词。用 putIfAbsent&#xff0c;确保只记录第一次出现的单词。 元音模糊匹配 把单词…

i2s_record_play

这章主要讲述i2s 1&#xff1a;环境及配件 esp32c3 esp32s3 idf5.4.1 INMP441 MAX98357A 都使用dma 2&#xff1a;eps32c3 测试 只有1个i2s 只能一边录 完 再播放 &#xff0c;内存太小&#xff0c;这里用 flash 存audio里 只说能 录音 能播放 &#xff0c;效果不好&#xff0…

Spring Boot 3 + EasyExcel 文件导入导出实现

SpringBoot集成EasyExcel 3.x&#xff1a;高效实现Excel数据的优雅导入与导出 在现代企业应用中&#xff0c;Excel作为数据交换的重要工具&#xff0c;几乎无处不在。如何高效且优雅地实现Excel数据的导入与导出&#xff0c;是每个开发者都需要面对的问题。EasyExcel是阿里巴巴…

Ruby编程实践:20个实用练习

1、编写一个程序,计算一年有多少小时。 以下是两种实现方式的代码: 方式一: puts 24*365方式二: puts 24*365 puts "(or #{24*366} on a leap year)"2、编写一个程序,计算十年中有多少分钟。 以下两种实现方式: 简单计算(未考虑闰年数量差异): ru…

逻辑回归(二):从原理到实战 - 训练、评估与应用指南

引言&#xff1a; 上期我们讲了什么是逻辑回归&#xff0c;了解了它如何利用Sigmoid函数将线性回归的输出转化为概率&#xff0c;并通过最大似然估计来寻找最佳参数。今天&#xff0c;我们将继续这段旅程&#xff0c;学习如何训练这个 模型、如何评估它的表现&#xff0c;以及如…