docker network create elastic
docker run --name elasticsearch8.6.2 --net elastic -p 9200:9200 -e discovery.type=single-node -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -e xpack.security.enabled=false -idt elasticsearch:8.6.2
curl localhost:9200
curl -X PUT "http://localhost:9200/my-book?pretty" \
-H 'Content-Type: application/json' \
-d'
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"properties": {
"line_id": {
"type": "long"
},
"line_number": {
"type": "keyword"
},
"play_name": {
"type": "keyword"
},
"speaker": {
"type": "keyword"
},
"speech_number": {
"type": "long"
},
"text_entry": {
"type": "text"
}
}
}
}
'
curl -X GET http://localhost:9200/my-book
//或者
curl -X GET http://localhost:9200/my-book?pretty
//下载数据文件
wget https://raw.githubusercontent.com/zq2599/blog_download_files/master/files/shakespeare_for_es_822.json
导入es数据
curl -H 'Content-Type: application/x-ndjson' -XPOST 'http://localhost:9200/_bulk' --data-binary @shakespeare_for_es_822.json
docker pull mobz/elasticsearch-head:5-alpine
docker run -d \
--name=elasticsearch-head \
--restart=always \
-p 9100:9100 \
mobz/elasticsearch-head:5-alpine
docker run -idt --name kibana --net elastic -p 5601:5601 kibana:8.6.2
docker exec -it elasticsearch8.6.2 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
true
to create an enrollment tokendocker exec -it kibana bin/kibana-verification-code
/mnt/docker/elk/logstash/config/logstash.yml
node.name: logstash862
http.host: "0.0.0.0"
xpack.monitoring.elasticsearch.hosts: [ "http://172.16.5.103:9200" ]
/mnt/docker/elk/logstash/pipeline/logstash.conf
input {
syslog {
port => 5044
}
}
filter {
json { source => "message" }
mutate {
remove_field => ["message"]
remove_field => ["host", "process", "log"]
remove_field => ["event", "service", "@version"]
}
}
output {
elasticsearch {
hosts => "172.16.5.103:9200"
index => "threatinfo-log-%{+YYYY.MM.dd}"
}
}
docker run -d --name logstash --net elastic -m 1000M --restart=always -p 5044:5044 --privileged=true -e ES_JAVA_OPTS="-Duser.timezone=Asia/Shanghai" -v /mnt/docker/elk/logstash/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf -v /mnt/docker/elk/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml logstash:8.6.2