input {
    file {
         type => "nginx_access_log"
        path => "/usr/local/openresty/nginx/logs/dispatch.comsunny.com*.access.log"
        start_position => "beginning"
         }   
     }    

input {
    file {
         type => "nginx_access_log"
        path => "/usr/local/openresty/nginx/logs/www.comsunny.com_*.access.log"
        start_position => "beginning"
         }
     }

input {
    file {
         type => "nginx_access_log"
        path => "/usr/local/openresty/nginx/logs/www.*.com.access.log"
        start_position => "beginning"
         }
     }

input {
    file {
         type => "nginx_access_log"
        path => "/usr/local/openresty/nginx/logs/api.comsunny.com_443.access.log"
        start_position => "beginning"
         }
     }

input {
    file {
         type => "nginx_access_log"
        path => "/usr/local/openresty/nginx/logs/internal.comsunny.com_80.access.log"
        start_position => "beginning"
         }
     }

input {
    file {
         type => "nginx_access_log"
        path => "/usr/local/openresty/nginx/logs/uu.taschy.com.access.log"
        start_position => "beginning"
         }
     }


input {
    file {
         type => "backend_log"
        path => "/var/prog/backend/logs/backend.log"
        start_position => "beginning"
         }
     }


filter {
  if [type] == "nginx_access_log" {
    grok {
         patterns_dir => "/opt/logstash/logstash-6.0.0/patterns/nginx"
      match => { "message" => "%{NGINX_ACCESS}" }
         }
                                   }
       }


filter {
  if [type] == "backend_log" {
    grok {
         patterns_dir => "/opt/logstash/logstash-6.0.0/patterns/backend.conf"
      match => { "message" => "%{BACKEND_LOG}" }
         }
                                   }
       }        


output {
  if [type] == "nginx_access_log" {
        elasticsearch {
            hosts => ["10.31.88.120:9200"]
            index => "nginx_access_log-%{+YYYY-MM-dd}"
                      }
                                    }
       }


output {
  if [type] == "backend_log" {
        elasticsearch {
            hosts => ["10.31.88.120:9200"]
            index => "backend_log-%{+YYYY-MM-dd}"
                      }
                                    }
       }             

