kuoss / lethe Goto Github PK
View Code? Open in Web Editor NEWLightweight flat log DB
License: Apache License 2.0
Lightweight flat log DB
License: Apache License 2.0
licenses check
licenses check
GNU find
search filter keyword with quotes
현재는 검색 키워드에 따옴표 없이 되는데 따옴표가 있는 것을 표준으로 하고자 합니다.
Describe the bug
fileservice
패키지 코드들 중 driver
인터페이스를 이용하지 않고 파일을 핸들링 하는 경우가 존재합니다.
로그 저장소의 변경을 위해서 모든 파일 핸들링은 driver
인터페이스를 통해서 이루어져야 합니다.
os
패키지의 함수로 직접 파일을 핸들링하고 있습니다.
lethe/storage/fileservice/clean.go
Line 28 in 3442627
lethe/storage/fileservice/fileservice.go
Line 23 in 3442627
lethe/storage/fileservice/list.go
Line 80 in 3442627
Expected behavior
-driver
인터페이스를 이용하여 구현, 필요시 인터페이스 확장
Export log statistics metrics
rotator 작동 중 ListFiles에서 panic(nil pointer dereference) 발생
개선방안
lethe.yml에서 신규 옵션 storage: 누락
lethe:v0.2.0-alpha.1
prometheus case
basic auth feature docs
https://prometheus.io/docs/guides/basic-auth/
auth config --web.config.file docs
https://prometheus.io/docs/prometheus/latest/configuration/https/
supports basic authentication
시간 순서대로 지워지지 않는다는 제보가 있었어요.
단위 테스트를 만들고 통과하도록 바꿔야겠습니다.
예를 들어 5개를 남긴다면...
node/node1 | node/node2 | pod/ns1 | pod/ns2 |
---|---|---|---|
0000-00-00_00.log ❌ | |||
1900-13-01_01.log ❌ | |||
2000-01-01_01.log ❌ | |||
2022-11-31_23.log ❌ | |||
2022-12-31_23.log ❌ | 2022-12-31_23.log ❌ | 2022-12-31_23.log ❌ | |
2023-01-01_00.log ❌ | 2023-01-01_00.log ❌ | ||
2023-02-21_23.log ❌ | 2023-02-21_23.log ❌ | 2023-02-21_23.log ❌ | 2023-02-21_23.log ❌ |
2023-02-22_01.log ❌ | 2023-02-22_01.log ❌ | 2023-02-22_01.log ❌ | 2023-02-22_01.log ❌ |
2023-02-22_02.log ❌ | 2023-02-22_02.log ✔️ | 2023-02-22_02.log ✔️ | |
2023-02-22_03.log ✔️ | 2023-02-22_03.log ✔️ | 2023-02-22_03.log ✔️ |
multiple operators
pod{namespace="kube-system"} |= "hello"
{"error":"not StringLiteral rhs: \u0026parser.StepInvariantExpr{Expr:(*parser.StringLiteral)(0xc0004323c0)}","errorType":"queryError","status":"error"}
staticcheck Error
Error: routes_test.go:5:2: "io/ioutil" has been deprecated since Go 1.16: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (SA1019)
Error: storage/driver/filesystem/driver.go:9:2: "io/ioutil" has been deprecated since Go 1.16: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (SA1019)
Coveralls 추가
현재 Codecov가 적용되어 있는데, Coveralls도 적용하여 사용해보고
나중에 장단점을 비교해보면 좋겠습니다.
DeleteBySize
일단 성능과 안정성을 고려하여
기존 sizingStrategy: disk 로직을 복원하고 기본값으로 했으면 합니다.
라고 생각했으나,
용량을 계산하면서 삭제할 파일 목록을 작성한 후에, 지우는 것으로 선회
외부 패키지에서 리턴 받는 에러들 중 래핑되지 않은 경우가 많습니다.
전체 에러 스택을 알기 위해서 래핑 해야 합니다.
테스트 환경 세팅 개선
Deprecated 함수 제거
for testing with mock in workspaces
for testing with mock in workspaces
GetAllFiles:" no files err=...
GetAllFilesWithSize: no files err=...
rotation_interval config 도입
retention:
rotation_interval: 20m ####
size: 100m
time: 1d
storage:
driver: filesystem
rootdirectory: /data/log
go-test-coverage
go-test-coverage
staticcheck 과정 중
import "internal/cpu"
import "internal/goarch"
부분에서 자주 실패합니다.
github action staticcheck logs...
-: cannot import "internal/cpu" (unexpected escape sequence in export data), possibly version skew - reinstall package (compile)
-: cannot import "internal/goarch" (unknown bexport format version -1
언젠가부터... ㅎㅎ
No response
No response
PR workflow Failing Test
go test with coverage
https://github.com/kuoss/lethe/actions/runs/4312183815/jobs/7522427736
The beginning
need to find out
none
query?logformat=json
logformat=string
# curl lethe/api/v1/query?logformat=string (default, legacy)
{
"status" : "success"
"data": {
"resultType": "logs",
"result": [
"2023-03-21T08:19:53.786445361Z[ns|pod1|nginx] hello nginx",
"2023-03-21T08:19:53.786445361Z[ns|pod1|redis] hello redis 1",
"2023-03-21T08:19:53.786445361Z[ns|pod1|redis] hello redis 2"
]
}
}
logformat=json
# curl lethe/api/v1/query?logformat=json
{
"status" : "success"
"data": {
"resultType": "logs",
"result": [
{"time":"2023-03-21T08:19:53.786445361Z", "namespace":"ns", "pod":"pod1", "container":"nginx", "log":"hello nginx" },
{"time":"2023-03-21T08:19:53.786445361Z", "namespace":"ns", "pod":"pod1", "container":"redis", "log":"hello redis 1" },
{"time":"2023-03-21T08:19:53.786445361Z", "namespace":"ns", "pod":"pod1", "container":"redis", "log":"hello redis 2" }
]
}
}
time="2023-07-17T07:02:27Z" level=info msg="DeleteBySize(23216655413 < 375809638400): DONE" file="delete.go:85"
time="2023-07-17T07:02:27Z" level=info msg="DeleteBySize(23,216,655,413 < 375,809,638,400): DONE" file="delete.go:85"
return warrnings pattern
ndjson log testdata
resultType streams alpha
support sizingStrategy disk for windows
Currently, it is supported only on Linux.
using common logger
lethe와 venti에서 동일한 logger 사용
improve workflow
improve workflow
기존에 지원하던 api들 중 prometheus 쿼리로 가능한 것들은 query로 전환하려하는데 web에서 호출하는 부분 수정 가능할까요?
/prometheus/time -> /prometheus/query?expr=time()
/prometheus/namespaces -> /prometheus/query?expr=kube_namespace_created
/prometheus/pods/:namespace -> /prometheus/query?expr=kube_pod_created{namespace="namespace01"}
/prometheus/nodes -> /prometheus/query?expr=kube_node_created
### Why is this needed?
/query 인터페이스에 param으로 호출 가능한 결과들이 편의성을 위해서 하드코딩된 인터페이스르 제공하고있다고 생각합니다.
time="2023-07-17T07:02:27Z" level=warning msg="glob err: walk err: walkFunc err: lstat /data/log/data/log/host.*: no such file or directory, prefix: host" file="clean.go:17"
too slow go-licenses (1h+)
https://github.com/kuoss/lethe/actions/runs/4276112104
Make the test faster
/api/v1/query?limit=100
goimports check 도입
glob err: walk err: walkFunc err: lstat /data/log/data/log/host.*
https://github.com/kuoss/lethe/blob/v0.2.2/storage/driver/filesystem/driver.go#L177-L194
dependabot issues 2023-11 v2
https://github.com/kuoss/lethe/actions/runs/5102453005
Annotations 5 warnings
goimports
The set-output
command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
go-vet
Restore cache failed: Dependencies file is not found in /home/runner/work/lethe/lethe. Supported file pattern: go.sum
go-licenses
Restore cache failed: Dependencies file is not found in /home/runner/work/lethe/lethe. Supported file pattern: go.sum
go-test-failfast
Restore cache failed: Dependencies file is not found in /home/runner/work/lethe/lethe. Supported file pattern: go.sum
go-test-coverage
Restore cache failed: Dependencies file is not found in /home/runner/work/lethe/lethe. Supported file pattern: go.sum
time="2023-05-31T05:36:31Z" level=error msg="deleteByAge err: listFiles err: walk err: &{%!e(string=walk err: walkFunc err: lstat /data/log: no such file or directory) %!e(*fmt.wrapError=&{walkFunc err: lstat /data/log: no such file or directory 0xc000466030})}" file="rotator.go:35"
time="2023-05-31T05:36:31Z" level=error msg="deleteBySize err: listFiles err: walk err: &{%!e(string=walk err: walkFunc err: lstat /data/log: no such file or directory) %!e(*fmt.wrapError=&{walkFunc err: lstat /data/log: no such file or directory 0xc000466240})}" file="rotator.go:39"
new clean pvc
.
v0.2.0
multiple filters feature
multiple filters feature
/data/log/host..service
/data/log/kube.var.log.containers.-.log
https://goreportcard.com/report/github.com/kuoss/lethe
Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.
letheql/parser/ast.go
Line 356: warning: cyclomatic complexity 18 of function Children() is high (> 15) (gocyclo)
letheql/parser/parse.go
Line 436: warning: cyclomatic complexity 74 of function (*parser).checkAST() is high (> 15) (gocyclo)
letheql/parser/lex.go
Line 350: warning: cyclomatic complexity 47 of function lexStatements() is high (> 15) (gocyclo)
Line 483: warning: cyclomatic complexity 17 of function lexInsideBraces() is high (> 15) (gocyclo)
letheql/engine.go
Line 207: warning: cyclomatic complexity 24 of function preprocessExprHelper() is high (> 15) (gocyclo)
Misspell Finds commonly misspelled English words
storage/logservice/match/label.go
Line 18: warning: "unknwon" is a misspelling of "unknown" (misspell)
테스트용 로그 파일들을 Go 코드로 처리하는 것이 비효율적으로 보여서 좀 개선해보고자 합니다.
not contain filter operator
logger 도입
Change to use packages modified promql instead of VictoriaSql
VictoriaSql has no update anymore and the modified promql is a more suitable form to apply the filter we want.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.