我使用的是流利版本1.4.6,并且试图从tomcat / logs文件夹中收集日志,但是我收到:
[error] [input:tail:tail.0] read error, check permissions
这些日志文件夹中的文件都是“ rw-r -----”(640)。
我试图通过更改logs文件夹中的文件的权限来确认它是否完全可以读取它,并且它可以工作,但这不能解决整个问题。
我的问题是,这是应该在tomcat级别设置还是可以通过流利的位完成?我可以以其他用户身份启动吗?
谢谢!
答案 0 :(得分:1)
您没有指定?您如何部署流利的位。
但是可以,您可以在Kubernetes中以其他用户身份指定SecurityContext来运行它。
例如:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluent-bit
namespace: logging
labels:
k8s-app: fluent-bit-logging
version: v1
kubernetes.io/cluster-service: "true"
spec:
selector:
matchLabels:
k8s-app: fluent-bit-logging
template:
metadata:
labels:
k8s-app: fluent-bit-logging
version: v1
kubernetes.io/cluster-service: "true"
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "2020"
prometheus.io/path: /api/v1/metrics/prometheus
spec:
securityContext:
runAsUser: 1000 ? user id that you want to run the containers in the pod as
containers:
- name: fluent-bit
image: fluent/fluent-bit:1.3.11
imagePullPolicy: Always
ports:
- containerPort: 2020
volumeMounts:
- name: varlog
mountPath: /var/log
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
readOnly: true
- name: fluent-bit-config
mountPath: /fluent-bit/etc/
- name: mnt
mountPath: /mnt
readOnly: true
...
✌️</ p>
答案 1 :(得分:1)
需要做的是将UMASK设置为env变量,并将其值设置为“ 111”,这将更改日志文件的权限,以便可以通过流利的位来拾取它们。