98 lines
2.0 KiB
YAML
98 lines
2.0 KiB
YAML
# 部署命名空间 base
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: logstash-config
|
|
data:
|
|
logstash.conf: |-
|
|
input {
|
|
beats {
|
|
port => 5044
|
|
}
|
|
}
|
|
|
|
filter {
|
|
if [tags][json] {
|
|
json {
|
|
source => "message"
|
|
}
|
|
}
|
|
mutate {
|
|
split => { "[log][file][path]" => "/" }
|
|
add_field => { "env" => "%{[log][file][path][3]}" }
|
|
}
|
|
}
|
|
|
|
output {
|
|
elasticsearch {
|
|
hosts => ["http://10.2.0.12:30019"]
|
|
index => "%{[env]}-logback-beaconfire-%{+YYYY.MM.dd}"
|
|
}
|
|
}
|
|
logstash.yml: |-
|
|
http.host: "0.0.0.0"
|
|
xpack.monitoring.elasticsearch.hosts: [ "http://10.2.0.12:30019" ]
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: logstash
|
|
labels:
|
|
app: logstash
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: logstash
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: logstash
|
|
spec:
|
|
containers:
|
|
- name: logstash
|
|
image: docker.elastic.co/logstash/logstash:7.16.3
|
|
ports:
|
|
- containerPort: 5044
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 128Mi
|
|
limits:
|
|
cpu: 1
|
|
memory: 1Gi
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /usr/share/logstash/pipeline/logstash.conf
|
|
subPath: logstash.conf
|
|
readOnly: true
|
|
- name: config
|
|
mountPath: /usr/share/logstash/config/logstash.yml
|
|
subPath: logstash.yml
|
|
readOnly: true
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: logstash-config
|
|
items:
|
|
- key: logstash.conf
|
|
path: logstash.conf
|
|
- key: logstash.yml
|
|
path: logstash.yml
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: logstash
|
|
labels:
|
|
app: logstash
|
|
spec:
|
|
ports:
|
|
- port: 5044
|
|
targetPort: 5044
|
|
selector:
|
|
app: logstash
|
|
type: ClusterIP |