Es = Elasticsearch (hosts=[{'Host':"elb-elasticsearch.cn-north-1.elb.amazonaws.com.cn",'Port':"9200"}],http_auth=("username","Password")) T= Datetime.fromtimestamp (int (1529986664), Pytz.timezone ('Asia/shanghai'))Print(t) data= { " Region":"cn","Env":"Dev","Product":"Reliability","Service":"DevOps","ObjectType":"EC2","Endpoint":"cn-dev-reliability-devops-ec2-172.31.116.5","Metric":"tcp_syn_sent","value": 800,
"timestamp": T, "BeginTime": T,"StartTime": 0,"Endtime": 0,"Step": 60,"CounterType":"COUNTER","Tag":"{aaa==1,bbb=2}","DataSource":"Transfer","kinesis":"true"} es.index (Index="kinesis-2015.06.26", doc_type="testdata", Body=data)
Comments:
"timestamp": T, incoming time parameters do not format the time, otherwise it will be an error, perhaps with my elk time stamp configuration, if you encounter similar problems can be noted under.
Python stores data to Elasticsearch and then graphically analyzes it via Kinaba