From efded2818279ca6ff0742b919144e62a7d73e578 Mon Sep 17 00:00:00 2001 From: ycz008 Date: Fri, 22 Sep 2023 16:55:55 +0800 Subject: [PATCH] add logstash --- dev-upgrade/elastic/kibana.yaml | 48 +++++++++--------- dev-upgrade/elastic/logstash.yml | 85 ++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 23 deletions(-) create mode 100644 dev-upgrade/elastic/logstash.yml diff --git a/dev-upgrade/elastic/kibana.yaml b/dev-upgrade/elastic/kibana.yaml index fe09808..63a4375 100644 --- a/dev-upgrade/elastic/kibana.yaml +++ b/dev-upgrade/elastic/kibana.yaml @@ -7,21 +7,7 @@ data: server.name: kibana server.host: 0.0.0.0 elasticsearch.hosts: [ "http://elastic:9200" ] ---- -apiVersion: v1 -kind: Service -metadata: - name: kibana - labels: - app: kibana -spec: - ports: - - port: 5601 - targetPort: 5601 - nodePort: 30013 - selector: - app: kibana - type: NodePort + --- apiVersion: apps/v1 kind: Deployment @@ -42,11 +28,8 @@ spec: containers: - name: kibana image: docker.elastic.co/kibana/kibana:7.16.3 - volumeMounts: - - name: config - mountPath: /usr/share/kibana/config/kibana.yml - subPath: kibana.yml - readOnly: true + ports: + - containerPort: 5601 resources: requests: cpu: 100m @@ -54,12 +37,31 @@ spec: limits: cpu: 1 memory: 1Gi - ports: - - containerPort: 5601 + volumeMounts: + - name: config + mountPath: /usr/share/kibana/config/kibana.yml + subPath: kibana.yml + readOnly: true volumes: - name: config configMap: name: kibana-config items: - key: kibana.yml - path: kibana.yml \ No newline at end of file + path: kibana.yml + +--- +apiVersion: v1 +kind: Service +metadata: + name: kibana + labels: + app: kibana +spec: + ports: + - port: 5601 + targetPort: 5601 + nodePort: 30013 + selector: + app: kibana + type: NodePort \ No newline at end of file diff --git a/dev-upgrade/elastic/logstash.yml b/dev-upgrade/elastic/logstash.yml new file mode 100644 index 0000000..7151d81 --- /dev/null +++ b/dev-upgrade/elastic/logstash.yml @@ -0,0 +1,85 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: logstash-config +data: + logstash.conf: |- + input { + beats { + port => 5044 + } + } + + filter { + if [tags][json] { + json { + source => "message" + } + } + } + + output { + stdout { codec => rubydebug } + elasticsearch { + hosts => ["http://elastic:9200"] + index => "dev-logback-beaconfire-%{+YYYY.MM.dd}" + } + } + + +--- +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 + volumes: + - name: config + configMap: + name: logstash-config + items: + - key: logstash.conf + path: logstash.conf + +--- +apiVersion: v1 +kind: Service +metadata: + name: logstash + labels: + app: logstash +spec: + ports: + - port: 5044 + targetPort: 5044 + selector: + app: logstash + type: ClusterIP \ No newline at end of file