Kubernetes实战(二十四)-Pod log查询和存储实战

Pod 日志是容器内产生的日志数据,其存储在/var/log/containers/*.log中,kubectl logd pod_name所输出的日志就是/var/log/containers/*.log中指定pod的日志。

1 kubectl logs方式

复制代码
# kubectl logs nginx-deployment-5c4dbf4c7-l84fz  -n prod 
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/01/30 09:02:03 [notice] 1#1: using the "epoll" event method
2024/01/30 09:02:03 [notice] 1#1: nginx/1.25.3
2024/01/30 09:02:03 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14) 
2024/01/30 09:02:03 [notice] 1#1: OS: Linux 5.10.134-15.al8.x86_64
2024/01/30 09:02:03 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/01/30 09:02:03 [notice] 1#1: start worker processes
2024/01/30 09:02:03 [notice] 1#1: start worker process 29
2024/01/30 09:02:03 [notice] 1#1: start worker process 30
2024/01/30 09:02:03 [notice] 1#1: start worker process 31
2024/01/30 09:02:03 [notice] 1#1: start worker process 32
172.27.80.1 - - [30/Jan/2024:09:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024/01/30 09:26:43 [error] 29#29: *1425 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "118.178.254.228"
10.220.15.23 - - [30/Jan/2024:09:26:43 +0000] "GET /favicon.ico HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36" "-"
10.220.15.23 - - [30/Jan/2024:09:30:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:10:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:10:20:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:10:25:29 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (compatible; InternetMeasurement/1.0; +https://internet-measurement.com/)" "-"
10.220.15.23 - - [30/Jan/2024:10:30:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:10:40:13 +0000] "GET http://118.178.254.228/ HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36" "-"
172.27.80.1 - - [30/Jan/2024:10:40:13 +0000] "GET http://118.178.254.228/ HTTP/1.1" 200 615 "-" "Apache-HttpClient/5.1.3 (Java/1.8.0_342)" "-"
2024/01/30 10:40:13 [error] 32#32: *5686 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.27.80.1, server: localhost, request: "GET http://118.178.254.228/favicon.ico HTTP/1.1", host: "118.178.254.228"
172.27.80.1 - - [30/Jan/2024:10:40:13 +0000] "GET http://118.178.254.228/favicon.ico HTTP/1.1" 404 153 "-" "Apache-HttpClient/5.1.3 (Java/1.8.0_342)" "-"
10.220.15.23 - - [30/Jan/2024:10:46:06 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36" "-"
10.220.15.23 - - [30/Jan/2024:11:00:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:11:10:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:11:20:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024/01/30 11:41:18 [error] 29#29: *9232 open() "/usr/share/nginx/html/.git/config" failed (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /.git/config HTTP/1.1", host: "118.178.254.228"
10.220.15.23 - - [30/Jan/2024:11:41:18 +0000] "GET /.git/config HTTP/1.1" 404 555 "-" "Mozilla/5.0 (X11; Linux i686 (x86_64)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3187.0 Safari/537.366" "-"
10.220.15.23 - - [30/Jan/2024:11:50:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:12:08:47 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" "-"
2024/01/30 12:09:33 [error] 31#31: *10868 "/usr/share/nginx/html/webui/index.html" is not found (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /webui/ HTTP/1.1", host: "118.178.254.228"
10.220.15.23 - - [30/Jan/2024:12:09:33 +0000] "GET /webui/ HTTP/1.1" 404 153 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0" "-"
2024/01/30 12:10:38 [error] 31#31: *10932 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "118.178.254.228"
10.220.15.23 - - [30/Jan/2024:12:10:38 +0000] "GET /favicon.ico HTTP/1.1" 404 153 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/109.0" "-"
10.220.15.23 - - [30/Jan/2024:13:00:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:13:18:32 +0000] "\x03\x00\x00/*\xE0\x00\x00\x00\x00\x00Cookie: mstshash=Administr" 400 157 "-" "-" "-"
172.27.80.1 - - [30/Jan/2024:13:40:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:13:44:54 +0000] "GET http://118.178.254.228/ HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" "-"
172.27.80.1 - - [30/Jan/2024:13:44:54 +0000] "GET http://118.178.254.228/ HTTP/1.1" 200 615 "-" "Apache-HttpClient/5.1.3 (Java/1.8.0_342)" "-"
2024/01/30 13:44:54 [error] 32#32: *16447 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.27.80.1, server: localhost, request: "GET http://118.178.254.228/favicon.ico HTTP/1.1", host: "118.178.254.228"
172.27.80.1 - - [30/Jan/2024:13:44:54 +0000] "GET http://118.178.254.228/favicon.ico HTTP/1.1" 404 153 "-" "Apache-HttpClient/5.1.3 (Java/1.8.0_342)" "-"
10.220.15.23 - - [30/Jan/2024:14:00:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:14:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:14:18:46 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" "-"
172.27.80.1 - - [30/Jan/2024:14:40:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:14:40:19 +0000] "\x16\x03\x01\x00\xDE\x01\x00\x00\xDA\x03\x03jb\x17z/&\xDF\xC8\xE9\xD1Z\xC4\x94\xFC\x00\x9Fj\x90N\xCAhD\x8E\x14\xD2}\x183SJ\xD7\x99\x00\x00n\xC00\xC0,\xC02\xC0.\xC0/\xC0+\xC01\xC0-\x00\xA5\x00\xA3\x00\xA1\x00\x9F\x00\xA4\x00\xA2\x00\xA0\x00\x9E\xC0(\xC0$\xC0\x14\xC0" 400 157 "-" "-" "-"
2024/01/30 14:40:21 [error] 32#32: *19651 open() "/usr/share/nginx/html/.env" failed (2: No such file or directory), client: 172.27.80.1, server: localhost, request: "GET /.env HTTP/1.1", host: "118.178.254.228"
172.27.80.1 - - [30/Jan/2024:14:40:21 +0000] "GET /.env HTTP/1.1" 404 555 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" "-"
172.27.80.1 - - [30/Jan/2024:15:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:15:20:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:15:40:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:16:00:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:16:10:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:16:30:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:17:10:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:17:20:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:17:30:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:17:40:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:17:50:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:18:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:18:39:25 +0000] "\x16\x03\x01\x00\xEE\x01\x00\x00\xEA\x03\x03Aq\x90\xDF+\x06\x00\xD4\x12M(_\xA2\xB2\x81v\xBBn\x04SY\x13\xF4\xF5(s\x07g+\x04\x9DQ Y-|uT\x06Y\xDE\xB3\x91\x06\x8EL+\xA1\xCDEiu7\x97\xB4 x\xA5\xD9\x8Dms=52\x00&\xC0+\xC0/\xC0,\xC00\xCC\xA9\xCC\xA8\xC0\x09\xC0\x13\xC0" 400 157 "-" "-" "-"
172.27.80.1 - - [30/Jan/2024:18:40:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:19:02:30 +0000] "GET / HTTP/1.1" 200 615 "-" "-" "-"
10.220.15.23 - - [30/Jan/2024:19:20:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:19:37:22 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" "-"
172.27.80.1 - - [30/Jan/2024:19:40:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024/01/30 19:51:34 [error] 32#32: *37753 open() "/usr/share/nginx/html/sslvpnLogin.html" failed (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /sslvpnLogin.html HTTP/1.1", host: "118.178.254.228:80"
10.220.15.23 - - [30/Jan/2024:19:51:34 +0000] "GET /sslvpnLogin.html HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36" "-"
2024/01/30 19:51:34 [error] 32#32: *37754 open() "/usr/share/nginx/html/api/sonicos/auth" failed (2: No such file or directory), client: 172.27.80.1, server: localhost, request: "GET /api/sonicos/auth HTTP/1.1", host: "118.178.254.228:80"
172.27.80.1 - - [30/Jan/2024:19:51:34 +0000] "GET /api/sonicos/auth HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36" "-"
2024/01/30 19:51:34 [error] 32#32: *37755 open() "/usr/share/nginx/html/api/sonicos/tfa" failed (2: No such file or directory), client: 172.27.80.1, server: localhost, request: "GET /api/sonicos/tfa HTTP/1.1", host: "118.178.254.228:80"
172.27.80.1 - - [30/Jan/2024:19:51:34 +0000] "GET /api/sonicos/tfa HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36" "-"
10.220.15.23 - - [30/Jan/2024:20:20:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:20:40:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:20:50:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024/01/30 21:01:51 [error] 32#32: *41857 open() "/usr/share/nginx/html/static/admin/javascript/hetong.js" failed (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /static/admin/javascript/hetong.js HTTP/1.1", host: "118.178.254.228"
10.220.15.23 - - [30/Jan/2024:21:01:51 +0000] "GET /static/admin/javascript/hetong.js HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Linux; Android 10; LIO-AN00 Build/HUAWEILIO-AN00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Mobile Safari/537.36" "-"
172.27.80.1 - - [30/Jan/2024:21:30:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:21:53:42 +0000] "GET / HTTP/1.1" 200 615 "-" "python-requests/2.31.0" "-"
172.27.80.1 - - [30/Jan/2024:22:30:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:22:40:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:22:50:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024/01/30 22:54:03 [error] 32#32: *48379 open() "/usr/share/nginx/html/TCi9QBtOgokYJq0yp5PEhIWXSzh" failed (2: No such file or directory), client: 172.27.80.1, server: localhost, request: "GET /TCi9QBtOgokYJq0yp5PEhIWXSzh HTTP/1.1", host: "118.178.254.228"
172.27.80.1 - - [30/Jan/2024:22:54:03 +0000] "GET /TCi9QBtOgokYJq0yp5PEhIWXSzh HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36" "-"
172.27.80.1 - - [30/Jan/2024:23:00:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:23:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:23:30:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [30/Jan/2024:23:40:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [30/Jan/2024:23:51:39 +0000] "\x16\x03\x01\x00\xEE\x01\x00\x00\xEA\x03\x03]g\x13\xC2\xD8U\x8B\xF5$\x87\xE2T\xBC1\xCE\xB5C\xF3\x94<\xD7>p\xFD\x85\x1C\xD5gV\xDB\x7F\xB7 \x95F\xAB\xD0\xCA\x1C~\xD4\x17\xDF\xF8\x12\xFB\x91\x18H\x90\x11\xC3\xBDr\xB9S\x15\x10\xF5\x9At\xE7S\x0E\xB5\x00&\xCC\xA8\xCC\xA9\xC0/\xC00\xC0+\xC0,\xC0\x13\xC0\x09\xC0\x14\xC0" 400 157 "-" "-" "-"
2024/01/31 00:01:06 [error] 32#32: *52292 open() "/usr/share/nginx/html/boaform/admin/formLogin" failed (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "POST /boaform/admin/formLogin HTTP/1.1", host: "118.178.254.228:80", referrer: "http://118.178.254.228:80/admin/login.asp"
10.220.15.23 - - [31/Jan/2024:00:01:06 +0000] "POST /boaform/admin/formLogin HTTP/1.1" 404 153 "http://118.178.254.228:80/admin/login.asp" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0" "-"
10.220.15.23 - - [31/Jan/2024:00:01:07 +0000] "" 400 0 "-" "-" "-"
172.27.80.1 - - [31/Jan/2024:00:20:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [31/Jan/2024:00:50:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [31/Jan/2024:01:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
10.220.15.23 - - [31/Jan/2024:01:20:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
172.27.80.1 - - [31/Jan/2024:01:29:00 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.2623.112 Safari/537.36" "-"
2024/01/31 01:29:01 [error] 29#29: *57418 open() "/usr/share/nginx/html/robots.txt" failed (2: No such file or directory), client: 172.27.80.1, server: localhost, request: "GET /robots.txt HTTP/1.1", host: "118.178.254.228:80"
172.27.80.1 - - [31/Jan/2024:01:29:01 +0000] "GET /robots.txt HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 QIHU 360SE" "-"
10.220.15.23 - - [31/Jan/2024:01:29:04 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36" "-"
172.27.80.1 - - [31/Jan/2024:01:54:15 +0000] "GET / HTTP/1.1" 200 615 "-" "Expanse, a Palo Alto Networks company, searches across the global IPv4 space multiple times per day to identify customers&#39; presences on the Internet. If you would like to be excluded from our scans, please send IP addresses/domains to: scaninfo@paloaltonetworks.com" "-"

2 查看/var/logs/containers/*.log方式

复制代码
$ cd /var/log/containers
$ ls -al | grep nginx-deployment-5c4dbf4c7-l84fz
lrwxrwxrwx   1 root root   100 Jan 30 17:02 nginx-deployment-5c4dbf4c7-l84fz_prod_nginx-e68d10f9728281cf2111b4d00e61a1d0afa145a2a349573f9b6f56c114d19bf1.log -> /var/log/pods/prod_nginx-deployment-5c4dbf4c7-l84fz_b40760d8-891c-4103-abb0-dce907237fa8/nginx/0.log
$ cat nginx-deployment-5c4dbf4c7-l84fz_prod_nginx-e68d10f9728281cf2111b4d00e61a1d0afa145a2a349573f9b6f56c114d19bf1.log
2024-01-30T17:02:03.261825067+08:00 stdout F /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
2024-01-30T17:02:03.26186098+08:00 stdout F /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
2024-01-30T17:02:03.263897509+08:00 stdout F /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
2024-01-30T17:02:03.360137584+08:00 stdout F 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
2024-01-30T17:02:03.46644643+08:00 stdout F 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
2024-01-30T17:02:03.466664171+08:00 stdout F /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
2024-01-30T17:02:03.466759637+08:00 stdout F /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
2024-01-30T17:02:03.56187562+08:00 stdout F /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
2024-01-30T17:02:03.565395969+08:00 stdout F /docker-entrypoint.sh: Configuration complete; ready for start up
2024-01-30T17:02:03.664019413+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: using the "epoll" event method
2024-01-30T17:02:03.664039947+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: nginx/1.25.3
2024-01-30T17:02:03.664047538+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14) 
2024-01-30T17:02:03.664050112+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: OS: Linux 5.10.134-15.al8.x86_64
2024-01-30T17:02:03.664052575+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024-01-30T17:02:03.664064209+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: start worker processes
2024-01-30T17:02:03.664361718+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: start worker process 29
2024-01-30T17:02:03.664610746+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: start worker process 30
2024-01-30T17:02:03.665293348+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: start worker process 31
2024-01-30T17:02:03.665313399+08:00 stderr F 2024/01/30 09:02:03 [notice] 1#1: start worker process 32
2024-01-30T17:10:19.382095908+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:09:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T17:26:43.321935673+08:00 stderr F 2024/01/30 09:26:43 [error] 29#29: *1425 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "118.178.254.228"
2024-01-30T17:26:43.321998923+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:09:26:43 +0000] "GET /favicon.ico HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36" "-"
2024-01-30T17:30:20.48492399+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:09:30:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T18:10:19.485803242+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:10:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T18:20:20.046575183+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:10:20:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T18:25:29.035833543+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:10:25:29 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (compatible; InternetMeasurement/1.0; +https://internet-measurement.com/)" "-"
2024-01-30T18:30:19.270149988+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:10:30:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T18:40:13.503964824+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:10:40:13 +0000] "GET http://118.178.254.228/ HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36" "-"
2024-01-30T18:40:13.511879585+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:10:40:13 +0000] "GET http://118.178.254.228/ HTTP/1.1" 200 615 "-" "Apache-HttpClient/5.1.3 (Java/1.8.0_342)" "-"
2024-01-30T18:40:13.519540786+08:00 stderr F 2024/01/30 10:40:13 [error] 32#32: *5686 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.27.80.1, server: localhost, request: "GET http://118.178.254.228/favicon.ico HTTP/1.1", host: "118.178.254.228"
2024-01-30T18:40:13.519561777+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:10:40:13 +0000] "GET http://118.178.254.228/favicon.ico HTTP/1.1" 404 153 "-" "Apache-HttpClient/5.1.3 (Java/1.8.0_342)" "-"
2024-01-30T18:46:06.09469531+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:10:46:06 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36" "-"
2024-01-30T19:00:19.863214013+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:11:00:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T19:10:20.146222345+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:11:10:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T19:20:19.960024634+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:11:20:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T19:41:18.232762089+08:00 stderr F 2024/01/30 11:41:18 [error] 29#29: *9232 open() "/usr/share/nginx/html/.git/config" failed (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /.git/config HTTP/1.1", host: "118.178.254.228"
2024-01-30T19:41:18.232773524+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:11:41:18 +0000] "GET /.git/config HTTP/1.1" 404 555 "-" "Mozilla/5.0 (X11; Linux i686 (x86_64)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3187.0 Safari/537.366" "-"
2024-01-30T19:50:19.502395597+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:11:50:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T20:08:47.838950877+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:12:08:47 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" "-"
2024-01-30T20:09:33.912424294+08:00 stderr F 2024/01/30 12:09:33 [error] 31#31: *10868 "/usr/share/nginx/html/webui/index.html" is not found (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /webui/ HTTP/1.1", host: "118.178.254.228"
2024-01-30T20:09:33.912432191+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:12:09:33 +0000] "GET /webui/ HTTP/1.1" 404 153 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0" "-"
2024-01-30T20:10:38.82713456+08:00 stderr F 2024/01/30 12:10:38 [error] 31#31: *10932 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 10.220.15.23, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "118.178.254.228"
2024-01-30T20:10:38.827208363+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:12:10:38 +0000] "GET /favicon.ico HTTP/1.1" 404 153 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/109.0" "-"
2024-01-30T21:00:19.818771469+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:13:00:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T21:18:32.526824276+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:13:18:32 +0000] "\x03\x00\x00/*\xE0\x00\x00\x00\x00\x00Cookie: mstshash=Administr" 400 157 "-" "-" "-"
2024-01-30T21:40:19.870825771+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:13:40:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T21:44:54.89009128+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:13:44:54 +0000] "GET http://118.178.254.228/ HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" "-"
2024-01-30T21:44:54.926335029+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:13:44:54 +0000] "GET http://118.178.254.228/ HTTP/1.1" 200 615 "-" "Apache-HttpClient/5.1.3 (Java/1.8.0_342)" "-"
2024-01-30T21:44:54.96243992+08:00 stderr F 2024/01/30 13:44:54 [error] 32#32: *16447 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.27.80.1, server: localhost, request: "GET http://118.178.254.228/favicon.ico HTTP/1.1", host: "118.178.254.228"
2024-01-30T21:44:54.962437634+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:13:44:54 +0000] "GET http://118.178.254.228/favicon.ico HTTP/1.1" 404 153 "-" "Apache-HttpClient/5.1.3 (Java/1.8.0_342)" "-"
2024-01-30T22:00:20.336312884+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:14:00:20 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T22:10:19.491791836+08:00 stdout F 172.27.80.1 - - [30/Jan/2024:14:10:19 +0000] "GET http://azenv.net/ HTTP/1.1" 200 615 "-" "Go-http-client/1.1" "-"
2024-01-30T22:18:46.005288605+08:00 stdout F 10.220.15.23 - - [30/Jan/2024:14:18:46 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" "-"

可以通过EFK进行日志采集。

相关推荐
运维老郭8 小时前
【K8s运维实战】Kubernetes临时存储卷实战:emptyDir核心用法与gitRepo弃用迁移指南
运维·云原生·kubernetes
AAA@峥12 小时前
容器数据不丢失:Docker 分层存储 + Volume 共享、备份迁移完整指南
运维·docker·容器
十年磨一剑~13 小时前
docker 为何每次 docker tag才能 docker push
docker·容器·eureka
gs8014015 小时前
记一次多 Agent 架构在单节点 K8s 触发的 PID 耗尽与 Pod 驱逐(Evicted)大摸排
容器·架构·kubernetes
bukeyiwanshui16 小时前
20260701 k8s Metric Server
容器·贪心算法·kubernetes
江湖有缘16 小时前
基于Docker环境部署tillywork开源工作管理工具
docker·容器·开源
鸿儒51718 小时前
MR-50国产化GPU docker配置方法
docker·容器·mr
Zhu75820 小时前
在k8s集群部署ApacheHadoop单节点单数据副本
云原生·容器·kubernetes
Akamai中国20 小时前
Akamai收购安全企业浏览器提供商LayerX
人工智能·云原生·云计算·云服务