1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
| kind: ConfigMap apiVersion: v1 metadata: name: logstash-conf namespace: xxx data: logstash.yml: 'http.host: "0.0.0.0"' main-pipeline.conf: |- input{ udp{ port => 5000 codec => "json" } } filter { if [fields][requestContext][userAgent] == "kube-probe/1.26+" { drop { } } } output{ elasticsearch { #es地址 hosts => ["127.0.0.1:9200","127.0.0.1:9200","127.0.0.1:9200"] #索引 index => "logstash-%{[fields][appName]}-%{+YYYY.MM}" #权限 custom_headers => { "Authorization" => "Basic xxxxxxxxxxxxxxxxxxxxx==" } } } ---
kind: Deployment apiVersion: apps/v1 metadata: name: logstash-v1 namespace: xxx labels: app: logstash version: v1 spec: replicas: 1 selector: matchLabels: app: logstash version: v1 template: metadata: creationTimestamp: null labels: app: logstash version: v1 spec: volumes: - name: host-time hostPath: path: /etc/localtime type: "" - name: volume-jxd8b2 configMap: name: logstash-conf items: - key: logstash.yml path: logstash.yml defaultMode: 420 - name: volume-6bs4a5 configMap: name: logstash-conf items: - key: main-pipeline.conf path: main-pipeline.conf defaultMode: 420 containers: - name: container-1dbyu8 image: "logstash:8.13.0" ports: - name: udp-0 containerPort: 5000 protocol: UDP resources: limits: cpu: "1" memory: 1280Mi requests: cpu: 100m memory: 128Mi volumeMounts: - name: host-time readOnly: true mountPath: /etc/localtime - name: volume-jxd8b2 readOnly: true mountPath: /usr/share/logstash/config/logstash.yml subPath: logstash.yml - name: volume-6bs4a5 readOnly: true mountPath: /usr/share/logstash/pipeline terminationMessagePath: /dev/termination-log terminationMessagePolicy: File imagePullPolicy: IfNotPresent restartPolicy: Always terminationGracePeriodSeconds: 30 dnsPolicy: ClusterFirst serviceAccountName: default serviceAccount: default securityContext: {} schedulerName: default-scheduler strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 25% maxSurge: 25% revisionHistoryLimit: 10 progressDeadlineSeconds: 600
|