pod日志的收集我采用的方法是filebate+kafak+logstash 實現的
deployment配置文件
[root@laso-master-01 wechat]# cat deployment-wechat.yaml apiVersion: apps/v1 kind: Deployment metadata: name: wechat namespace: laso-prd spec: replicas: 2 strategy: rollingUpdate: # 滾動升級的策略,整個升級的過程中 pod的個數再2-4個之間 maxSurge: 1 # 滾動升級時會啟動一個pod maxUnavailable: 0 # 升級時允許最大的Unavailable的pod的個數 selector: matchLabels: app: wechat release: prd template: metadata: labels: app: wechat release: prd version: v1.2 annotations: # 監控需要的 prometheus_io_scrape_springboot: "true" prometheus.io/path: /metrics/prometheus prometheus.io/port: "9188" prometheus.io/scrape: "true" spec: nodeSelector: laso-tech-env: prd terminationGracePeriodSeconds: 120 containers: # pod - name: wechat image: registry-vpc.cn-beijing.aliyuncs.com/cn_genebox/wechat:v1.4.20-ccce77b command: ["/sbin/tini", "java","-XX:MetaspaceSize=150m", "-XX:MaxMetaspaceSize=200m","-Xmx400m","-Xms400m","-Xmn250m","-Xss228k","-jar","/wechat.jar","--spring.cloud.inetutils.ignored-interfaces=lo,lo:0"] args: ["--spring.profiles.active=prd"] imagePullPolicy: Always resources: limits: memory: "800Mi" # cpu: "0.3" requests: memory: "800Mi" # cpu: "0.3" lifecycle: preStop: exec: command: ["sh", "/prestop.sh"] env: - name: DBURL_LASO_SOCIAL_PLATFORM valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dburl_laso_social_platform" - name: DBUSER_LASO_SOCIAL_PLATFORM valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dbuser_laso_social_platform" - name: DBPWD_LASO_SOCIAL_PLATFORM valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dbpwd_laso_social_platform" - name: REDIS_IP valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "redis_ip" - name: REDIS_PORT valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "redis_port" - name: REDIS_PWD valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "redis_pwd" - name: DREAM_WEIXIN_WX-CONFIGS_APPID1 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_wx-configs_appId1" - name: DREAM_WEIXIN_WX-CONFIGS_APPSECRET1 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_wx-configs_appSecret1" - name: DREAM_WEIXIN_WX-CONFIGS_TOKEN1 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_wx-configs_token1" - name: DREAM_WEIXIN_WX-CONFIGS_ENCODINGAESKEY1 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_wx-configs_encodingAesKey1" - name: DREAM_WEIXIN_WX-CONFIGS_MESSAGEENCRYPT1 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_wx-configs_messageEncrypt1" - name: DREAM_WEIXIN_APP-ID1 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_app-id1" - name: DREAM_WEIXIN_APP-SECRET1 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_app-secret1" - name: DREAM_WEIXIN_APP-ID2 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_app-id2" - name: DREAM_WEIXIN_APP-SECRET2 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_app-secret2" - name: DREAM_WEIXIN_APP-ID3 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_app-id3" - name: DREAM_WEIXIN_APP-SECRET3 valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "dream_weixin_app-secret3" - name: LASO_CONFIG_REDPACK_WXAPPID valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "laso_config_redpack_wxAppid" - name: LASO_CONFIG_REDPACK_MCHID valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "laso_config_redpack_mchId" - name: LASO_CONFIG_REDPACK_KEY valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "laso_config_redpack_key" - name: LASO_CONFIG_REDPACK_SENDNAME valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "laso_config_redpack_sendName" - name: LASO_CONFIG_REDPACK_CERTPATH valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "laso_config_redpack_certPath" - name: EUREKA_URL valueFrom: secretKeyRef: name: "prd-secret-wechat" key: "eureka_url" - name: PROJECTNAME value: wechat - name: PACKAGENAME value: wechat ports: - name: port containerPort: 9188 readinessProbe: httpGet: port: port #也可以使用80 path: /smoketest initialDelaySeconds: 30 #容器啟動后等待1秒開始探測 periodSeconds: 10 #每隔3秒探測一次 livenessProbe: httpGet: port: port #也可以使用80 path: /smoketest initialDelaySeconds: 110 #容器啟動后等待10秒開始探測 periodSeconds: 5 #每隔3秒探測一次 successThreshold: 1 # 連續探測1次成功表示成功 failureThreshold: 2 # 連續探測3次失敗表示失敗 volumeMounts: - name: app-logs mountPath: /home/laso/logs/ # 拉取容器的賬戶密碼 imagePullSecrets: - name: prd-registry-secret #- name: prd-harbor-secret # 掛載卷 volumes: - name: app-logs hostPath: #path: /log/prd/ms-userbox # node主機的/log/consumer掛載在 pod的/tmp/laso/logs/consumer上 path: /log/prd/ # node主機的/log/consumer掛載在 pod的/tmp/laso/logs/consumer上 type: DirectoryOrCreate # 目錄不存在創建
主要的配置是將日志文件掛載在pod所在的宿主機上,這樣在宿主機中的 /log/prd/ 目錄中就能看到 pod中程序的日志了。
volumeMounts: - name: app-logs mountPath: /home/laso/logs/ # 拉取容器的賬戶密碼 imagePullSecrets: - name: prd-registry-secret #- name: prd-harbor-secret # 掛載卷 volumes: - name: app-logs hostPath: #path: /log/prd/ms-userbox # node主機的/log/consumer掛載在 pod的/tmp/laso/logs/consumer上 path: /log/prd/ # node主機的/log/consumer掛載在 pod的/tmp/laso/logs/consumer上 type: DirectoryOrCreate # 目錄不存在創建
將filebeta 程序放在k8s中的node節點上
filebeta 配置文件
[ansible@laso-elk template]$ cat prd_filebeat.yaml filebeat.prospectors: - input_type: log paths: - "/log/prd/wechat/*.log" multiline: pattern: '^\d{4}-\d{2}-' negate: true match: after fields: type: "wechat" log_topic: "prd03" output.kafka: enabled: true hosts: ["172.17.199.51:9092"] topic: '%{[fields.log_topic]}' partition.round_robin: reachable_only: false message.max.bytes: 1000000 required_acks: 1 compression: gzip compression_level: 1
172.17.199.51 是kafka的ip地址
logstash 配置文件 所在的服務器收集了所有pod 程序中的日志
配置文件的功能: 1 收集日志在lohstash所在的物理服務器上,2 將日志輸出到es中 3 將錯誤的日志 輸出到redis中(自己寫腳本,從redis中取日志,並給給釘釘群發消息)
[root@laso-elk file]# cat file.conf input { kafka{ bootstrap_servers => ["172.17.199.51:9092"] #client_id => "test" #group_id => "test" #auto_offset_reset => "latest" #從最新的偏移量開始消費 #consumer_threads => 5 #decorate_events => true #此屬性會將當前topic、offset、group、partition等信息也帶到message中 topics => ["prd","prd01","prd02","prd03","prd04","prd05","prd06"] #topics_pattern => "prd.*" auto_offset_reset => "earliest" max_poll_records => "10" type => "kafka" } } filter{ json { source => "message" } if "laso_" in [message] { if "it took" in [message] { grok{ match => {"message" => "(?<datetime>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{3}) \[(?<traceId>.*?)\] \[(?<thread>.*?)\] %{LOGLEVEL:level} (?<class_name>.*)::(?<method_name>.*) - call the \[(?<class>.*)\.(?<method>.*)\] (.*), it took (?<time>\d+)"} remove_tag => ["beats_input_codec_plain_applied"] } } else if "status" in [message] and "Response" in [message] { grok{ match => {"message" => "(?<datetime>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{3}) \[(?<traceId>.*?)\] \[(?<thread>.*?)\] %{LOGLEVEL:level} (?<class_name>.*)::(?<method_name>.*) - (.*)class\[(?<controller>.*)?\].* method\[(?<controller_method>.*?)\](.*)?\"msg\":(?<msg>.*)?\"status\":(?<status>.*)(\})"} remove_tag => ["beats_input_codec_plain_applied"] } } else { grok{ match => {"message" => "(?<datetime>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{3}) \[(?<traceId>.*?)\] \[(?<thread>.*?)\] %{LOGLEVEL:level} (?<class_name>.*)::(?<method_name>.*) - (?<log_message>.*)"} remove_tag => ["beats_input_codec_plain_applied"] } } } else { if "QrcodeControlle" in [message]{ grok{ match => {"message" => "(?<datetime>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{3}) \[(?<thread>.*?)\] %{LOGLEVEL:level} (?<class_name>.*)::(?<method_name>.*) - call the \[(?<class>.*)\.(?<method>.*)\] (.*), it took (?<time>\d+)"} remove_tag => ["beats_input_codec_plain_applied"] } } else if "status" in [message] and "Response" in [message] { grok{ match => {"message" => "(?<datetime>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{3}) \[(?<thread>.*?)\] %{LOGLEVEL:level} (?<class_name>.*)::(?<method_name>.*) - (.*)class\[(?<controller>.*)?\].* method\[(?<controller_method>.*?)\](.*)?\"msg\":(?<msg>.*)?\"status\":(?<status>.*)(\})"} remove_tag => ["beats_input_codec_plain_applied"] } } # 匹配traceId為空的 else if "it took" in [message]{ grok{ match => {"message" => "(?<datetime>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{3}) \[(?<traceId>.*?)\] \[(?<thread>.*?)\] %{LOGLEVEL:level} (?<class_name>.*)::(?<method_name>.*) - call the \[(?<class>.*)\.(?<method>.*)\] (.*), it took (?<time>\d+)"} remove_tag => ["beats_input_codec_plain_applied"] } } else if "HEAD" in [message]{ drop {} } else { grok{ match => {"message" => "(?<datetime>\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{3}) (\[\] )\[(?<thread>.*)\] %{LOGLEVEL:level} (?<class_name>.*)::(?<method_name>.*) - (?<log_message>.*)"} remove_tag => ["beats_input_codec_plain_applied"] } } } date { match => ["datetime", "yyyy-MM-dd HH:mm:ss.SSS"] target => "@timestamp" } ruby { # 新增索引日期,解決地區時差問題 code => "event.set('index_date', event.get('@timestamp').time.localtime + 8*60*60)" } mutate { convert => ["index_date", "string"] convert => ["status", "float"] convert => ["time", "float"] gsub => ["index_date", "T([\S\s]*?)Z", ""] #gsub => ["index_date", "-", "."] remove_field => "host" remove_field => "beat" remove_field => "offset" remove_field => "@version" remove_field => "source" # add_field => [ "messages","%{[fields][ip]} %{message}" ] #remove_field => "message" remove_field => "type" } } output { #if [message] =~ /(\[.*?\]\sERROR(?!\ssdk).*\s-(?!\s無法|\s未能).*)/{ if [message] =~ /(\[.*?\]\s\[?ERROR\]?(?!\ssdk).*\s-(?!\s無法|\s未能).*)/{ #exec { # command => "/home/lulin/python/logstash/producer_log.py %{[fields][type]} %{messages}" # } redis { batch => true batch_events => 50 codec => plain{charset=>"UTF-8"} congestion_interval => 30 # 1秒檢查一下擁塞阻塞 congestion_threshold => 50000 # list中可以存多少個items data_type => list db => 1 host => ["172.17.209.20:20027"] key => "%{[fields][type]}" password => lulinlaso port => 20027 shuffle_hosts => true } stdout { codec => rubydebug } } if [fields][type] == "lasogene_report_manager" { file { path => "/logs/prdlogs/lasogene_report_manager/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_applet_activity" { file { path => "/logs/prdlogs/laso_applet_activity/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_pet_distribution" { file { path => "/logs/prdlogs/laso_pet_distribution/info-%{index_date}.log" codec => line { format => "%{fields[ip]} %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_activity_marketing" { file { path => "/logs/prdlogs/laso_activity_marketing/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_express" { file { path => "/logs/prdlogs/ms_express/info-%{index_date}.log" codec => line { format => " %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_comment" { file { path => "/logs/prdlogs/laso_comment/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_community" { file { path => "/logs/prdlogs/laso_community/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_pet" { file { path => "/logs/prdlogs/laso_pet/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "prd_ms_buried_point" { file { path => "/logs/prdlogs/ms_buried_point/info-%{index_date}.log" codec => line { format => "%{fields[ip]} %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "prd_db_sync" { file { path => "/logs/prdlogs/db_sync/info-%{index_date}.log" codec => line { format => "%{fields[ip]} %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_admin" { file { path => "/logs/prdlogs/laso_admin/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_exchange" { file { path => "/logs/prdlogs/laso_exchange/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "lasogene_activity" { file { path => "/logs/prdlogs/lasogene_activity/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "lasogene_coffee" { file { path => "/logs/prdlogs/lasogene_coffee/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "lasogene_lab" { file { path => "/logs/prdlogs/lasogene_lab/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "lasogene_medicine" { file { path => "/logs/prdlogs/lasogene_medicine/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "lasogene_message" { file { path => "/logs/prdlogs/lasogene_message/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "lasogene_public" { file { path => "/logs/prdlogs/lasogene_public/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "lasogene_qa_service" { file { path => "/logs/prdlogs/lasogene_qa_service/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" # flush_size => 50000 # idle_flush_time => 5 index => "%{index_date}" } } if [fields][type] == "lasogene_qa_system" { file { path => "/logs/prdlogs/lasogene_qa_system/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" #flush_size => 50000 #idle_flush_time => 5 index => "%{index_date}" } } if [fields][type] == "lasogene_report" { file { path => "/logs/prdlogs/lasogene_report/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "lasogene_user" { file { path => "/logs/prdlogs/lasogene_user/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "prd_laso_insurance" { file { path => "/logs/prdlogs/laso_insurance/info-%{index_date}.log" codec => line { format => "%{fields[ip]} %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_onekey" { file { path => "/logs/prdlogs/laso_onekey/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_social" { file { path => "/logs/prdlogs/laso_social/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_address" { file { path => "/logs/prdlogs/ms_address/info-%{index_date}.log" codec => line { format => "%{fields[ip]} %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_admin" { file { path => "/logs/prdlogs/ms_admin/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "prd_ms_advert" { file { path => "/logs/prdlogs/ms_advert/info-%{index_date}.log" codec => line { format => "%{fields[ip]} %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_bond" { file { path => "/logs/prdlogs/ms_bond/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_box_report" { file { path => "/logs/prdlogs/ms_box_report/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_cart" { file { path => "/logs/prdlogs/ms_cart/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "prd_ms_consumer_promotion" { file { path => "/logs/prdlogs/ms_consumer_promotion/info-%{index_date}.log" codec => line { format => "%{fields[ip]} %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_goods" { file { path => "/logs/prdlogs/ms_goods/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_jg_push" { file { path => "/logs/prdlogs/ms_jg_push/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_lottery" { file { path => "/logs/prdlogs/ms_lottery/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_manager" { file { path => "/logs/prdlogs/ms_manager/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_manager_xxljob" { file { path => "/logs/prdlogs/ms_manager/xxljob_%{index_date}.log" codec => line { format => "%{message}" } } } if [fields][type] == "ms_marketing" { file { path => "/logs/prdlogs/ms_marketing/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_mq" { file { path => "/logs/prdlogs/ms_mq/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_order" { file { path => "/logs/prdlogs/ms_order/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_pay" { file { path => "/logs/prdlogs/ms_pay/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_points" { file { path => "/logs/prdlogs/ms_points/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_product" { file { path => "/logs/prdlogs/ms_product/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_promotion" { file { path => "/logs/prdlogs/ms_promotion/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_sso" { file { path => "/logs/prdlogs/ms_sso/info-%{index_date}.log" codec => line { format =>"%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_userbox" { file { path => "/logs/prdlogs/ms_userbox/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_vip" { file { path => "/logs/prdlogs/ms_vip/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "prd_ms_wxpush" { file { path => "/logs/prdlogs/ms_wxpush/info-%{index_date}.log" codec => line { format => "%{fields[ip]} %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_youzan" { file { path => "/logs/prdlogs/ms_youzan/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "prd_nginx" { file { path => "/logs/prdlogs/nginx/info-%{index_date}.log" codec => line { format => "%{fields[ip]} %{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "nutrition" { file { path => "/logs/prdlogs/nutrition/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "question" { file { path => "/logs/prdlogs/question/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "tob_report" { file { path => "/logs/prdlogs/tob_report/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "wechat" { file { path => "/logs/prdlogs/wechat/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ws_order_center" { file { path => "/logs/prdlogs/ws_order_center/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ws_points" { file { path => "/logs/prdlogs/ws_points/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "nginx_access" { file { path => "/logs/prdlogs/nginx/access-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "nginx_error" { file { path => "/logs/prdlogs/nginx/error-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_chip_manager" { file { path => "/logs/prdlogs/laso_chip_manager/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_ims" { file { path => "/logs/prdlogs/laso_ims/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_short_link" { file { path => "/logs/prdlogs/laso_short_link/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "app_token" { file { path => "/logs/prdlogs/app_token/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "xxl_job" { file { path => "/logs/prdlogs/xxl_job/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_gateway" { file { path => "/logs/prdlogs/laso_gateway/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_covid" { file { path => "/logs/prdlogs/laso_covid/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_tri_manager" { file { path => "/logs/prdlogs/laso_tri_manager/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_admin_gateway" { file { path => "/logs/prdlogs/laso_admin_gateway/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms-report-pdf" { file { path => "/logs/prdlogs/ms-report-pdf/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "laso_search" { file { path => "/logs/prdlogs/laso_search/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "ms_tmall" { file { path => "/logs/prdlogs/ms_tmall/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } if [fields][type] == "activity" { file { path => "/logs/prdlogs/activity/info-%{index_date}.log" codec => line { format => "%{message}" } } elasticsearch { hosts => "172.17.181.7:9200" index => "%{index_date}" } } }