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
04cd6681
Commit
04cd6681
authored
Sep 26, 2021
by
段孔乐
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/test-server' into dev
# Conflicts: # logstash/pipeline/logstash.conf
parents
552a168b
9655bac5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
23 deletions
+70
-23
Makefile
Makefile
+19
-0
elasticsearch.yml
elasticsearch/config/elasticsearch.yml
+2
-0
logstash.conf
logstash/pipeline/logstash.conf
+49
-23
No files found.
Makefile
0 → 100644
View file @
04cd6681
.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 @
04cd6681
...
...
@@ -4,10 +4,12 @@
#
cluster.name
:
"
docker-cluster"
network.host
:
0.0.0.0
cluster.max_shards_per_node
:
30000
## X-Pack settings
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html
#
xpack.license.self_generated.type
:
trial
xpack.monitoring.history.duration
:
3d
xpack.security.enabled
:
false
xpack.monitoring.collection.enabled
:
true
logstash/pipeline/logstash.conf
View file @
04cd6681
input
{
beats
{
port
=>
5044
}
beats
{
port
=>
5044
}
tcp
{
port
=>
5000
}
tcp
{
port
=>
5000
}
}
## Add your filters / logstash plugins configuration here
filter
{
if
(
"stat.log"
in
[
log
][
file
][
path
]) {
drop
{}
}
mutate
{
add_field
=> {
"input-type"
=>
"%{[agent][type]}-%{[input][type]}"
}
remove_field
=> [
"agent"
,
"ecs"
,
"tags"
,
"input"
,
"host"
]
}
if
"stat.log"
in
[
log
][
file
][
path
] {
drop
{}
}
if
"chain"
in
[
log
][
file
][
path
] {
drop
{}
}
if
"convert"
in
[
log
][
file
][
path
] {
drop
{}
}
mutate
{
add_field
=> {
"input-type"
=>
"%{[agent][type]}-%{[input][type]}"
}
remove_field
=> [
"agent"
,
"ecs"
,
"tags"
,
"input"
,
"host"
]
}
json
{
source
=>
"message"
skip_on_invalid_json
=>
true
target
=>
"json"
}
if
"v1"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][version]"
=>
"v1"
} }
}
else
if
"v2"
in
[
log
][
file
][
path
]{
# version
if
"v1"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][version]"
=>
"v1"
} }
}
else
if
"v2"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][version]"
=>
"v2"
} }
}
else
{
mutate
{
add_field
=> {
"[service][version]"
=>
"v"
} }
...
...
@@ -35,10 +43,25 @@ filter {
## mutate { add_field => { "[env][name]" => "test" } }
## }
# program
if
"backend-micro"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][program]"
=>
"backend"
} }
}
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"
} }
}
mutate
{
add_field
=> {
"[service][program]"
=>
"backend"
} }
if
"gateway"
in
[
log
][
file
][
path
]{
# 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"
} }
}
else
if
"swagger"
in
[
log
][
file
][
path
]{
mutate
{
add_field
=> {
"[service][name]"
=>
"swagger"
} }
...
...
@@ -56,6 +79,12 @@ filter {
mutate
{
add_field
=> {
"[service][name]"
=>
"tx"
} }
}
else
if
"role-service"
in
[
log
][
file
][
path
] {
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
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"user"
} }
}
else
if
"department-service"
in
[
log
][
file
][
path
] {
...
...
@@ -67,7 +96,6 @@ filter {
}
else
if
"trace-service"
in
[
log
][
file
][
path
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"trace"
} }
}
else
if
"external"
in
[
log
][
file
][
path
] {
mutate
{
update
=> {
"[service][program]"
=>
"exdb"
} }
if
"sync"
in
[
log
][
file
][
path
] {
mutate
{
add_field
=> {
"[service][name]"
=>
"sync"
} }
}
else
if
"convert"
in
[
log
][
file
][
path
] {
...
...
@@ -76,17 +104,15 @@ filter {
mutate
{
add_field
=> {
"[service][name]"
=>
"rpc"
} }
}
}
else
if
"chain"
in
[
log
][
file
][
path
] {
mutate
{
update
=> {
"[service][program]"
=>
"chain"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"chain33"
} }
}
else
{
mutate
{
update
=> {
"[service][program]"
=>
"others"
} }
mutate
{
add_field
=> {
"[service][name]"
=>
"other"
} }
}
}
output
{
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"
]
}
}
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