Skip to content

Commit fe3f1af

Browse files
committed
fix:修复版本比对异常
feat:日志添加时间类型
1 parent e883611 commit fe3f1af

File tree

5 files changed

+119
-76
lines changed

5 files changed

+119
-76
lines changed

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM golang:1.22-alpine AS builder
2+
3+
LABEL stage=gobuilder
4+
5+
ENV GOPROXY https://goproxy.cn,direct
6+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
7+
8+
RUN apk update --no-cache && apk add --no-cache tzdata
9+
10+
WORKDIR /build
11+
12+
ADD go.mod .
13+
ADD go.sum .
14+
RUN go mod download
15+
COPY . .
16+
# 静态编译Go程序
17+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o app stash/stash.go
18+
19+
20+
FROM alpine
21+
22+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
23+
24+
WORKDIR /app
25+
26+
# 复制编译好的二进制文件到运行时镜像
27+
COPY --from=builder /build/app /app
28+
29+
COPY --from=builder /build/stash/etc /app/etc
30+
31+
CMD ["./app", "-f", "etc/config.yaml"]

stash/Dockerfile

Lines changed: 0 additions & 30 deletions
This file was deleted.

stash/etc/config.yaml

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
11
Clusters:
2-
- Input:
3-
Kafka:
4-
Name: gostash
5-
Brokers:
6-
- "172.16.186.16:19092"
7-
- "172.16.186.17:19092"
8-
Topics:
9-
- k8slog
10-
Group: pro
11-
Consumers: 16
12-
Filters:
13-
- Action: drop
14-
Conditions:
15-
- Key: k8s_container_name
16-
Value: "-rpc"
17-
Type: contains
18-
- Key: level
19-
Value: info
20-
Type: match
21-
Op: and
22-
- Action: remove_field
23-
Fields:
24-
- message
25-
- _source
26-
- _type
27-
- _score
28-
- _id
29-
- "@version"
30-
- topic
31-
- index
32-
- beat
33-
- docker_container
34-
- offset
35-
- prospector
36-
- source
37-
- stream
38-
- Action: transfer
39-
Field: message
40-
Target: data
41-
Output:
42-
ElasticSearch:
43-
Hosts:
44-
- http://172.16.141.4:9200
45-
- http://172.16.141.5:9200
46-
Index: "{.event}-{{yyyy-MM-dd}}"
2+
- Input:
3+
Kafka:
4+
Name: gostash
5+
Brokers:
6+
- "43.198.115.11:30019"
7+
Topics:
8+
- BotLog
9+
- ChatRoomLog
10+
- GameLog
11+
- GatewayLog
12+
- MiniGameLog
13+
- StoreLog
14+
- UserLog
15+
Group: gostash
16+
Consumers: 16
17+
Filters:
18+
- Action: remove_field
19+
Fields:
20+
- message
21+
- _source
22+
- _score
23+
- _id
24+
- "@version"
25+
- topic
26+
- index
27+
- beat
28+
- docker_container
29+
- offset
30+
- prospector
31+
- source
32+
- stream
33+
- Action: transfer
34+
Field: ts
35+
Target: timestamp
36+
Output:
37+
ElasticSearch:
38+
Hosts:
39+
- http://43.198.115.11:30002
40+
Username: elastic
41+
Password: iT2Fw06YEAD4719fJ8k8rY9K
42+
Index: "pokerup-log-{{yyyy-MM-dd}}"

stash/etc/config_back.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Clusters:
2+
- Input:
3+
Kafka:
4+
Name: gostash
5+
Brokers:
6+
- "172.16.186.16:19092"
7+
- "172.16.186.17:19092"
8+
Topics:
9+
- k8slog
10+
Group: pro
11+
Consumers: 16
12+
Filters:
13+
- Action: drop
14+
Conditions:
15+
- Key: k8s_container_name
16+
Value: "-rpc"
17+
Type: contains
18+
- Key: level
19+
Value: info
20+
Type: match
21+
Op: and
22+
- Action: remove_field
23+
Fields:
24+
- message
25+
- _source
26+
- _type
27+
- _score
28+
- _id
29+
- "@version"
30+
- topic
31+
- index
32+
- beat
33+
- docker_container
34+
- offset
35+
- prospector
36+
- source
37+
- stream
38+
- Action: transfer
39+
Field: message
40+
Target: data
41+
Output:
42+
ElasticSearch:
43+
Hosts:
44+
- http://172.16.141.4:9200
45+
- http://172.16.141.5:9200
46+
Index: "{.event}-{{yyyy-MM-dd}}"

stash/stash.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/zeromicro/go-zero/core/service"
1717
)
1818

19-
var configFile = flag.String("f", "etc/config.yaml", "Specify the config file")
19+
var configFile = flag.String("f", "./stash/etc/config.yaml", "Specify the config file")
2020

2121
func toKqConf(c config.KafkaConf) []kq.KqConf {
2222
var ret []kq.KqConf

0 commit comments

Comments
 (0)