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
9655bac5
Commit
9655bac5
authored
Sep 26, 2021
by
testserver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update conf
parent
f93260e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
9 deletions
+56
-9
Makefile
Makefile
+19
-0
elasticsearch.yml
elasticsearch/config/elasticsearch.yml
+2
-0
logstash.conf
logstash/pipeline/logstash.conf
+35
-9
No files found.
Makefile
0 → 100644
View file @
9655bac5
.PHONY
:
run restart log-logstash log-es log-kibana stop
run
:
@
docker-compose up
-d
restart
:
@
docker-compose restart
log-logstash
:
@
docker-compose logs
--tail
=
100
-f
logstash
log-es
:
@
docker-compose logs
--tail
=
100
-f
elasticsearch
log-kibana
:
@
docker-compose logs
--tail
=
100
-f
kibana
stop
:
@
docker-compose down
elasticsearch/config/elasticsearch.yml
View file @
9655bac5
...
@@ -4,10 +4,12 @@
...
@@ -4,10 +4,12 @@
#
#
cluster.name
:
"
docker-cluster"
cluster.name
:
"
docker-cluster"
network.host
:
0.0.0.0
network.host
:
0.0.0.0
cluster.max_shards_per_node
:
30000
## X-Pack settings
## X-Pack settings
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html
#
#
xpack.license.self_generated.type
:
trial
xpack.license.self_generated.type
:
trial
xpack.monitoring.history.duration
:
3d
xpack.security.enabled
:
false
xpack.security.enabled
:
false
xpack.monitoring.collection.enabled
:
true
xpack.monitoring.collection.enabled
:
true
logstash/pipeline/logstash.conf
View file @
9655bac5
...
@@ -12,9 +12,15 @@ input {
...
@@ -12,9 +12,15 @@ input {
filter
{
filter
{
if
(
"stat.log"
in
[
log
][
file
][
path
])
{
if
"stat.log"
in
[
log
][
file
][
path
]
{
drop
{}
drop
{}
}
}
if
"chain"
in
[
log
][
file
][
path
] {
drop
{}
}
if
"convert"
in
[
log
][
file
][
path
] {
drop
{}
}
mutate
{
mutate
{
add_field
=> {
"input-type"
=>
"%{[agent][type]}-%{[input][type]}"
}
add_field
=> {
"input-type"
=>
"%{[agent][type]}-%{[input][type]}"
}
remove_field
=> [
"agent"
,
"ecs"
,
"tags"
,
"input"
,
"host"
]
remove_field
=> [
"agent"
,
"ecs"
,
"tags"
,
"input"
,
"host"
]
...
@@ -24,6 +30,8 @@ filter {
...
@@ -24,6 +30,8 @@ filter {
skip_on_invalid_json
=>
true
skip_on_invalid_json
=>
true
target
=>
"json"
target
=>
"json"
}
}
# version
if
"v1"
in
[
log
][
file
][
path
]{
if
"v1"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][version]"
=>
"v1"
} }
mutate
{
add_field
=> {
"[service][version]"
=>
"v1"
} }
}
else
if
"v2"
in
[
log
][
file
][
path
]{
}
else
if
"v2"
in
[
log
][
file
][
path
]{
...
@@ -35,10 +43,25 @@ filter {
...
@@ -35,10 +43,25 @@ filter {
## mutate { add_field => { "[env][name]" => "test" } }
## mutate { add_field => { "[env][name]" => "test" } }
## }
## }
# program
mutate
{
add_field
=> {
"[service][program]"
=>
"backend"
} }
if
"backend-micro"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][program]"
=>
"backend"
} }
if
"gateway"
in
[
log
][
file
][
path
]{
}
else
if
"supervisor"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][program]"
=>
"supervisor"
} }
}
else
if
"chain"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][program]"
=>
"chain"
} }
}
else
if
"backend"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][program]"
=>
"backend"
} }
}
else
if
"externaldb"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][program]"
=>
"externaldb"
} }
}
else
{
mutate
{
add_field
=> {
"[service][program]"
=>
"other"
} }
}
# services
if
"supervisor"
in
[
log
][
file
][
path
]{
mutate
{
update
=> {
"[service][program]"
=>
"supervisor"
} }
}
else
if
"gateway"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][name]"
=>
"gateway"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"gateway"
} }
}
else
if
"swagger"
in
[
log
][
file
][
path
]{
}
else
if
"swagger"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][name]"
=>
"swagger"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"swagger"
} }
...
@@ -56,6 +79,12 @@ filter {
...
@@ -56,6 +79,12 @@ filter {
mutate
{
add_field
=> {
"[service][name]"
=>
"tx"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"tx"
} }
}
else
if
"role-service"
in
[
log
][
file
][
path
] {
}
else
if
"role-service"
in
[
log
][
file
][
path
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"role"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"role"
} }
}
else
if
"shorturl"
in
[
log
][
file
][
path
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"shorturl"
} }
}
else
if
"express"
in
[
log
][
file
][
path
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"express"
} }
}
else
if
"contract"
in
[
log
][
file
][
path
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"contract"
} }
}
else
if
"user-service"
in
[
log
][
file
][
path
] {
}
else
if
"user-service"
in
[
log
][
file
][
path
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"user"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"user"
} }
}
else
if
"department-service"
in
[
log
][
file
][
path
] {
}
else
if
"department-service"
in
[
log
][
file
][
path
] {
...
@@ -67,7 +96,6 @@ filter {
...
@@ -67,7 +96,6 @@ filter {
}
else
if
"trace-service"
in
[
log
][
file
][
path
] {
}
else
if
"trace-service"
in
[
log
][
file
][
path
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"trace"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"trace"
} }
}
else
if
"external"
in
[
log
][
file
][
path
] {
}
else
if
"external"
in
[
log
][
file
][
path
] {
mutate
{
update
=> {
"[service][program]"
=>
"exdb"
} }
if
"sync"
in
[
log
][
file
][
path
] {
if
"sync"
in
[
log
][
file
][
path
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"sync"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"sync"
} }
}
else
if
"convert"
in
[
log
][
file
][
path
] {
}
else
if
"convert"
in
[
log
][
file
][
path
] {
...
@@ -76,17 +104,15 @@ filter {
...
@@ -76,17 +104,15 @@ filter {
mutate
{
add_field
=> {
"[service][name]"
=>
"rpc"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"rpc"
} }
}
}
}
else
if
"chain"
in
[
log
][
file
][
path
] {
}
else
if
"chain"
in
[
log
][
file
][
path
] {
mutate
{
update
=> {
"[service][program]"
=>
"chain"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"chain33"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"chain33"
} }
}
else
{
}
else
{
mutate
{
update
=> {
"[service][program]"
=>
"others"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"other"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"other"
} }
}
}
}
}
output
{
output
{
elasticsearch
{
elasticsearch
{
index
=>
"%{[env]}-%{[service][program]}-%{[service][version]}-%{[service][name]}-%{+YYYY.MM}"
index
=>
"%{[env]}-%{[service][program]}-%{[service][version]}-%{[service][name]}-%{+YYYY.MM}
-000000
"
hosts
=> [
"elasticsearch:9200"
]
hosts
=> [
"elasticsearch:9200"
]
}
}
}
}
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