| | 26 | |
| | 27 | == Query index/data/add/delete == |
| | 28 | |
| | 29 | show index (DB) that use in ELK |
| | 30 | {{{ |
| | 31 | curl -X GET localhost:9200/_cat/indices |
| | 32 | }}} |
| | 33 | |
| | 34 | When start logstash, we need to edit logstash.conf under pipeline/logstash.conf |
| | 35 | {{{ |
| | 36 | #!sh |
| | 37 | [krit@mini bitnami-docker-logstash]$ cat pipeline/logstash.conf |
| | 38 | input { |
| | 39 | http { |
| | 40 | host => "0.0.0.0" # default: 0.0.0.0 |
| | 41 | port => 31311 # default: 8080 |
| | 42 | } |
| | 43 | } |
| | 44 | |
| | 45 | filter { |
| | 46 | csv { |
| | 47 | separator => "," |
| | 48 | columns => ["ID", "Moisture", "Temperature", "Light"] |
| | 49 | convert => { |
| | 50 | "Moisture" => "float" |
| | 51 | "Temperature" => "float" |
| | 52 | "Light" => "float" |
| | 53 | } |
| | 54 | } |
| | 55 | |
| | 56 | mutate { |
| | 57 | remove_field => ["host", "headers"] |
| | 58 | } |
| | 59 | } |
| | 60 | |
| | 61 | output { |
| | 62 | elasticsearch { |
| | 63 | hosts => ["elasticsearch:9200"] |
| | 64 | index => "logstash-2021.02.02-000001" |
| | 65 | } |
| | 66 | } |
| | 67 | [krit@mini bitnami-docker-logstash]$ |
| | 68 | }}} |
| | 69 | |
| | 70 | |
| | 71 | add data |
| | 72 | {{{ |
| | 73 | curl -XPUT 'http://172.18.0.3:31311/twitter/tweet/1' -d 'abc,4.0,5.0,1.0' |
| | 74 | }}} |
| | 75 | |
| | 76 | search and show all data |
| | 77 | {{{ |
| | 78 | curl -X GET http://localhost:9200/logstash-2021.02.02-000001/_doc/_search?pretty=true |
| | 79 | }}} |
| | 80 | |