input {
  file {
    type => "tomcat-access-log"
    path => "/apps/tomcat/logs/tomcat_access_log.*.log"
    start_position => "beginning"
    stat_interval => "3"
    codec => json
  }

  file {
    type => "nginx-access-log"
    path => "/apps/nginx/logs/access.log"
    start_position => "beginning"
    stat_interval => "3"
    codec => json
  }

  file {
    type => "nginx-error-log"
    path => "/apps/nginx/logs/error.log"
    start_position => "beginning"
    stat_interval => "3"
  }

  file {
    type => "tomcat-access-log-0363"
    path => "/apps/tomcat/logs/tomcat_access_log.*.log"
    start_position => "beginning"
    stat_interval => "3"
    codec => json
  }
}

output {
  if [type] == "tomcat-access-log" {
    elasticsearch {
    hosts => ["192.168.3.60:9200","192.168.3.61:9200","192.168.3.62:9200"]
    index => "tomcat-access-log-%{+yyyy.MM.dd}"
    }
  }

  if [type] == "nginx-access-log" {
    elasticsearch {
    hosts => ["192.168.3.60:9200","192.168.3.61:9200","192.168.3.62:9200"]
    index => "nginx-access-log-%{+yyyy.MM.dd}"
    }
  }

  if [type] == "nginx-error-log" {
    elasticsearch {
    hosts => ["192.168.3.60:9200","192.168.3.61:9200","192.168.3.62:9200"]
    index => "nginx-error-log-%{+yyyy.MM.dd}"
    }
  }

  if [type] == "tomcat-access-log-0363" {
    redis {
      data_type => "list"
      key => "tomcat-access-log-0363"
      host => "192.168.3.63"
      port => "6379"
      db => "0"
      password => "password"
    }
  }
}

标签: none

添加新评论