Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
docker-elk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段孔乐
docker-elk
Commits
122287a2
Commit
122287a2
authored
Apr 29, 2022
by
testserver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update config
parent
5aad62d9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
15 deletions
+17
-15
docker-compose.yml
docker-compose.yml
+4
-5
init-kibana.sh
init-kibana.sh
+3
-3
export.ndjson
kibana/export.ndjson
+0
-0
logstash.conf
logstash/pipeline/logstash.conf
+10
-7
No files found.
docker-compose.yml
View file @
122287a2
...
@@ -11,9 +11,7 @@ services:
...
@@ -11,9 +11,7 @@ services:
source
:
./elasticsearch/config/elasticsearch.yml
source
:
./elasticsearch/config/elasticsearch.yml
target
:
/usr/share/elasticsearch/config/elasticsearch.yml
target
:
/usr/share/elasticsearch/config/elasticsearch.yml
read_only
:
true
read_only
:
true
-
type
:
volume
-
"
./elasticsearch/data:/usr/share/elasticsearch/data"
source
:
elasticsearch
target
:
/usr/share/elasticsearch/data
ports
:
ports
:
-
"
$ES_PORT1:9200"
-
"
$ES_PORT1:9200"
-
"
$ES_PORT2:9300"
-
"
$ES_PORT2:9300"
...
@@ -76,5 +74,6 @@ networks:
...
@@ -76,5 +74,6 @@ networks:
elk
:
elk
:
driver
:
bridge
driver
:
bridge
volumes
:
#volumes:
elasticsearch
:
# elasticsearch:
# driver: local
init-kibana.sh
View file @
122287a2
...
@@ -10,14 +10,14 @@ function setDefaultIndex() {
...
@@ -10,14 +10,14 @@ function setDefaultIndex() {
curl
--location
--request
POST
"http://
$kibana_host
/api/kibana/settings"
\
curl
--location
--request
POST
"http://
$kibana_host
/api/kibana/settings"
\
--header
'kbn-version: 7.12.0'
\
--header
'kbn-version: 7.12.0'
\
--header
'Content-Type: application/json'
\
--header
'Content-Type: application/json'
\
--data
-raw
"{
\"
changes
\"
:{
\"
defaultIndex
\"
:
\"
$1
\"
}}"
--data
"{
\"
changes
\"
:{
\"
defaultIndex
\"
:
\"
$1
\"
}}"
}
}
function
addILMPolicy
()
{
function
addILMPolicy
()
{
resp
=
$(
resp
=
$(
curl
-s
-XPUT
"http://
$es_host
/_ilm/policy/service-log"
\
curl
-s
-XPUT
"http://
$es_host
/_ilm/policy/service-log"
\
--header
'Content-Type: application/json'
\
--header
'Content-Type: application/json'
\
--data
-raw
'{"policy":{"phases":{"hot":{"min_age":"0ms","actions":{"set_priority":{"priority":100}}},"delete":{"min_age":"365
d","actions":{"delete":{"delete_searchable_snapshot":true}}}}}}'
--data
'{"policy":{"phases":{"hot":{"min_age":"0ms","actions":{"set_priority":{"priority":100}}},"delete":{"min_age":"90
d","actions":{"delete":{"delete_searchable_snapshot":true}}}}}}'
)
)
echo
"
$resp
"
echo
"
$resp
"
if
contain
"
$resp
"
'{"acknowledged":true}'
;
then
if
contain
"
$resp
"
'{"acknowledged":true}'
;
then
...
@@ -31,7 +31,7 @@ function addIndexTemplate() {
...
@@ -31,7 +31,7 @@ function addIndexTemplate() {
resp
=
$(
resp
=
$(
curl
-s
-XPUT
"http://
$es_host
/_index_template/service-log"
\
curl
-s
-XPUT
"http://
$es_host
/_index_template/service-log"
\
--header
'Content-Type: application/json'
\
--header
'Content-Type: application/json'
\
--data
-raw
'{"template":{"settings":{"index":{"lifecycle":{"name":"service-log"}}},"mappings":{"_source":{"excludes":[],"includes":[],"enabled":true},"_routing":{"required":false},"dynamic":true,"numeric_detection":false,"date_detection":true,"dynamic_date_formats":["strict_date_optional_time","yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"],"dynamic_templates":[]}},"index_patterns":["*-service-*"
]}'
--data
'{"priority":0,"template":{"settings":{"index":{"lifecycle":{"name":"service-log"},"number_of_shards":"1","number_of_replicas":"0"}},"mappings":{"_routing":{"required":false},"numeric_detection":false,"dynamic_date_formats":["strict_date_optional_time","yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"],"_source":{"excludes":[],"includes":[],"enabled":true},"dynamic":true,"dynamic_templates":[],"date_detection":true}},"index_patterns":["*-service-*","*backend*","*chian*","*exdb*","*external*","*other*","*supervisor*","*tanxin*"],"composed_of":[
]}'
)
)
echo
"
$resp
"
echo
"
$resp
"
if
contain
"
$resp
"
'{"acknowledged":true}'
;
then
if
contain
"
$resp
"
'{"acknowledged":true}'
;
then
...
...
kibana/export.ndjson
View file @
122287a2
This diff is collapsed.
Click to expand it.
logstash/pipeline/logstash.conf
View file @
122287a2
...
@@ -11,22 +11,25 @@ input {
...
@@ -11,22 +11,25 @@ input {
## Add your filters / logstash plugins configuration here
## Add your filters / logstash plugins configuration here
filter
{
filter
{
if
"lvl=dbug msg=dealBlock module=util cur="
in
[
message
]{
drop
{}
}
if
"stat.log"
in
[
log
][
file
][
path
] {
if
"stat.log"
in
[
log
][
file
][
path
] {
drop
{}
drop
{}
}
}
if
"error"
in
[
log
][
file
][
path
] {
if
"error"
in
[
log
][
file
][
path
] {
}
else
if
"sync"
in
[
log
][
file
][
path
]{
}
else
if
"chain"
in
[
log
][
file
][
path
] {
}
else
if
"chain"
in
[
log
][
file
][
path
] {
drop
{}
drop
{}
}
else
if
"Chain"
in
[
log
][
file
][
path
] {
}
else
if
"Chain"
in
[
log
][
file
][
path
] {
drop
{}
drop
{}
}
else
if
"convert"
in
[
log
][
file
][
path
]{
}
else
if
"convert"
in
[
log
][
file
][
path
]{
if
"person"
in
[
env
]{
##
if "person" in [env]{
drop
{}
##
}
else
if
"demo"
in
[
env
] {
##
}else if "demo" in [env] {
drop
{}
##
drop{}
}
##
}
}
}
if
"backend-env-v1"
in
[
log
][
file
][
path
] {
if
"backend-env-v1"
in
[
log
][
file
][
path
] {
drop
{}
drop
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment