input {
        beats {
                port => 5000
        }

}


filter {

 
     ruby {
         code => "event.set('timestamp', event.get('@timestamp').time.localtime + 8*60*60)"
     }
     ruby {
         code => "event.set('@timestamp',event.get('timestamp'))"
     }

    mutate{

     remove_field=>["@version"]
     remove_field=>["log"]
     remove_field=>["@version"]
     remove_field=>["input"]
     remove_field=>["fields"]
     remove_field=>["tags"]
     remove_field=>["host"]
     remove_field=>["agent"]
     remove_field=>["ecs"]
     remove_field=>["timestamp"]


    }

}

## Add your filters / logstash plugins configuration here

output {

    if [json][http_activity_id]!="" {
        elasticsearch {
                hosts => "elasticsearch:9200"
                user => "elastic"
                password => "hudongtang2020"
                index=>"visit-log-%{+YYYYMM}"   #设置索引名字


        }
    }
}