zoukankan      html  css  js  c++  java
  • k8s 日志按体现分类与采集思路

    k8s-日志按体现分类与采集思路

    1. k8s-日志按体现分类与采集思路

    • 创建nginx服务为示例

      [root@k8s-master ~]# kubectl run nginx --image=nginx
      pod/nginx created
      [root@k8s-master ~]# kubectl get pods
      NAME                   READY   STATUS    RESTARTS   AGE
      nginx                  1/1     Running   0          3m29s
      web-5df8b97c79-hksfc   1/1     Running   0          42h
      [root@k8s-master ~]# kubectl exec -it nginx -- bash
      root@nginx:/# ls /var/log/nginx/
      access.log  error.log
      

      我们可以看到这里有日志文件,但是不会输出数据到文件,因为nginx把日志输出容器外

    • 创建tomcat服务为示例

      [root@k8s-master ~]# kubectl run tomcat --image=tomcat
      pod/tomcat created
      [root@k8s-master ~]# kubectl get pods
      NAME                   READY   STATUS    RESTARTS   AGE
      nginx                  1/1     Running   0          14m
      tomcat                 1/1     Running   0          80s
      web-5df8b97c79-hksfc   1/1     Running   0          42h
      [root@k8s-master ~]# kubectl exec -it tomcat -- bash
      root@tomcat:/usr/local/tomcat# ls
      BUILDING.txt  CONTRIBUTING.md  LICENSE  NOTICE  README.md  RELEASE-NOTES  RUNNING.txt  bin  conf  lib  logs  native-jni-lib  temp  webapps  webapps.dist  work
      root@tomcat:/usr/local/tomcat# cd logs/
      root@tomcat:/usr/local/tomcat/logs# ls -a
      .  ..  catalina.2021-07-07.log  host-manager.2021-07-07.log  localhost.2021-07-07.log  localhost_access_log.2021-07-07.txt  manager.2021-07-07.log
      root@tomcat:/usr/local/tomcat/logs# cat localhost_access_log.2021-07-07.txt 
      10.244.235.192 - - [07/Jul/2021:05:15:42 +0000] "GET / HTTP/1.1" 404 682
      

      这里我们发现,tomcat服务我们请求后,是吧数据存放在容器里

  • 相关阅读:
    String painter HDU
    GCD Counting-树形DP
    XOR UVALive
    BZOJ-9-3295: [Cqoi2011]动态逆序对
    E
    Stars HDU
    二维单调队列(理想的正方形+修筑绿化带)
    P3622 [APIO2007]动物园
    COJ1160[一本通 5.3 例 1」Amount of Degrees
    [ZJOI2008]骑士
  • 原文地址:https://www.cnblogs.com/scajy/p/15543415.html
Copyright © 2011-2022 走看看