hsdtsyl KubeSphere 日志功能分两部分:日志采集 + 日志查询

日志采集,由 Fluent Bit 完成,外接 TLS support 的 es,需要修改 Fluent Bit 配置(目前支持)

日志查询,由 KubeSphere elastic go-client 完成,目前不支持 X-Pack Security,会在后续版本支持

目前 2.1.0 版本外接商业版 es,能采集日志但可能无法在 KubeSphere UI 上查看。请问是否需要我整理下日志采集配置的文档?

1 年 后

huanggze 请问现在3.0版本支持了吗?直接对接外部es带有用户密码的吗?我看指定logging的url没有用户密码参数。

2 个月 后

现在还是可以收集到带验证的xpack, ks UI 上还不能从 xpack 里查
我们看看什么时候可以支持 @wanjunlei

2 个月 后

3.0外接ES只需要修改fluent-bit.conf中的配置嘛?是不是意味着ks-install修改了会覆盖这个配置

3 个月 后

csz711 外置es xpack需要自己配置,我们的client端设置了账户和密码validation, 在ks-installer里面可以配置。

    zhu733756 可否详细些?ks-installer里面关于es配置只看到了(因为ks3.1自带的es版本太低,所以在其他ns里另搭了一个es)
    ·es:
    elasticsearchDataReplicas: 1
    elasticsearchDataVolumeSize: 20Gi
    elasticsearchMasterReplicas: 1
    elasticsearchMasterVolumeSize: 4Gi
    elkPrefix: logstash
    externalElasticsearchPort: 9200
    externalElasticsearchUrl: elasticsearch-master.ks-logging-system
    logMaxAge: 7

      csz711

      kubectl -n kubesphere-system edit cc ks-installer

      ks官方文档里面也可以找到,你可以先搜搜。

        22 天 后

        zhu733756

        如何配置该日志收集写入到启用了 es-xpack 权限的 es中。

        下面的事件日志和审计日志都可以正常写入到外部启用了 es-xpack 权限的 es中。

        设置的外部url和端口正确吗?
        如果还是无法解决,可以执行下面语句检查添加的账户密码信息

        kubectl -n kubesphere-logging-system get outputs.logging.kubesphere.io es -oyaml
        kubectl -n kubesphere-system get cm kubesphere-config -oyaml

          zhu733756 非常感谢您的回复。
          1、执行 kubectl -n kubesphere-logging-system get outputs.logging.kubesphere.io es -oyaml

          apiVersion: logging.kubesphere.io/v1alpha2
          kind: Output
          metadata:
           ......
           spec:
            es:
              host: 10.1.7.51
              logstashFormat: true
              logstashPrefix: ks-ks-log
              port: 30402
              timeKey: '@timestamp'
            matchRegex: (?:kube|service)\.(.*)

          端口和地址都正确,但是缺少账号密码的信息。
          fluent-bit-w9bkg,的日志报错则是说,没有提供账号密码。

          [2021/07/09 08:49:24] [error] [output:es:es.2] HTTP status=401 URI=/_bulk, response:
          {"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/_bulk]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/_bulk]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}

          2、执行 kubectl -n kubesphere-system get cm kubesphere-config -oyaml
          这是我的有用输出

            kubesphere.yaml: |
              authentication:
                authenticateRateLimiterMaxTries: 10
                authenticateRateLimiterDuration: 10m0s
                loginHistoryRetentionPeriod: 168h
                maximumClockSkew: 10s
                multipleLogin: True
                kubectlImage: 192.168.101.30/devops/kubesphere/kubectl:v1.19.0
                jwtSecret: "NdrdmdbcerddelxdsdndrR2ddEBzreV1"
              network:
                ippoolType: none
              multicluster:
                enable: true
                agentImage: 192.168.101.30/devops/kubesphere/tower:v0.2.0
                proxyPublishService: tower.kubesphere-system.svc
              monitoring:
                endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090
              events:
                host: http://10.1.7.51:30402
                basicAuth: True
                username: "elastic"
                password: "elastic"
                indexPrefix: ks-ks-events
              auditing:
                enable: true
                host: http://10.1.7.51:30402
                basicAuth: True
                username: "elastic"
                password: "elastic"
                indexPrefix: ks-ks-auditing
              alerting:
                prometheusEndpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090
                thanosRulerEndpoint: http://thanos-ruler-operated.kubesphere-monitoring-system.svc:10902
                thanosRuleResourceLabels: thanosruler=thanos-ruler,role=thanos-alerting-rules

          没有显示 logging 的账号密码信息,我不知道在哪个位置填。

          output这样改

          es:
             HTTP_USER:
             HTTP_PASSwd:__

          你的这个config文件不完整啊,你重启下installer试试

          5 天 后

          求助,更换xpack外置ES出现问题

          背景:集群创建时,我先使用了内置ES。后需要改成带xpack的外置ES。
          1.我在cc中增加了如下配置

          2.打开集群设置的日志收集器发现并没有发生变化,还是内置ES地址

          3.随即我删除了这个收集器,打算自己新增,但是发现并没有密码框

          4.不输入账号密码的情况下,fluent-bit.conf配置文件中没有密码 ,fluent-bit pod报错未认证


          5.随即我修改了output,增加了账号密码

          然后:fluent-bit.conf依然没有增加账号密码的配置,并且我按照fluent手册中手动加入HTTP_User & HTTP_Passwd
          更新后配置文件自动还原。

          请问我该进行什么操作呢?

            niutendo
            我刚才通过kubectl -n kubesphere-system get cm kubesphere-config -oyaml 检查到我的password输成passwork了。更新了一下cc,kubesphere-config 已经正常。通过界面去查询日志也已经不提示报错了。看来就剩下fluent-bit.conf中配置如何生效的问题了。

              niutendo 1 如果配置完毕后账户名密码不在output中,需要删除对应status重启ks-installer;
              2 配置完毕发现账户名密码已经注入了,toolbox无法查询数据,要把ks-apiserver重启一下。

                zhu733756
                不好意思,没明白对应status是什么意思。

                我删除了日志收集器中的ES配置,重启了installer pod,发现并没自动创建出日志收集器呢。