596 Commits

Author SHA1 Message Date
烈香
8b1763238f docs: Update README_CN.md
Signed-off-by: 烈香 <hengyoush1@163.com>
2025-01-10 10:16:07 +08:00
烈香
3d3e1e4065 test(e2e): add e2e test for sendfile & server side https (#264) 2025-01-09 20:48:32 +08:00
烈香
05b2c4075b feat(protocol): introduce the concept of streams to prepare for future support of HTTP2 and Mongo (#258)
Signed-off-by: 烈香 <hengyoush1@163.com>
2025-01-09 13:51:01 +08:00
烈香
6d507da90e fix(bpf/ssl): first HTTPS request on the server side might not be captured (#259) 2025-01-09 03:00:09 +08:00
Laitron
6653fef907 feat: new version detection (#256) 2025-01-08 14:43:29 +08:00
烈香
3f6a44c753 feat: support for parsing ipip packet (#257)
* feat: support for parsing ipip packet

    This PR introduces a new feature for parsing IPIP packets and correctly associating them.

    Additionally, this PR improves the current logic in processor.go to prevent the incorrect association of syscall and kernel events. When new events arrive, they are first enqueued and then processed only if they have been in the queue longer than a specified time limit. This is necessary because when many short connections use the same tgid-fd, syscall and kernel events may arrive asynchronously in user space. As a result, events from a new connection might reach user space before the connection event itself, causing the new connection's events to be incorrectly associated with the old connection and leading to erroneous time calculations.

  And to ensure that the total time calculation is not negative, the syscall event will report the syscall start time and the syscall duration. By adding the start time and the duration, we can determine the end time. This way, when calculating the client's elapsed time, we can subtract the start time of the write syscall from the end time of the read syscall.

  Additionally, to ensure that DEV_IN and TCP_IN events are present when the server receives the first request, the concept of a first packet event is introduced. Even if the kernel does not find conn_info or other information when reporting the event, as long as its seq=1, it will be considered a first packet. This allows it to be directly reported to user space. In user space, the connection is found based on its sock key, and then it is converted into a kernevent for processing. This way, even for the server's first request, we can see the total time and read from socket time.

* fix: remove bpf_printk statements

* feat: add first-packet-event-map-page-num option

* refactor: translate comments to english
2025-01-08 12:38:35 +08:00
xmchx
8ff2696e1d feat: support rocketMQ (#231)
feat: support rocketMQ

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
Co-authored-by: Spencer Cai <spencercjh@gmail.com>
Co-authored-by: 烈香 <hengyoush1@163.com>
2025-01-07 19:42:33 +08:00
Spencer Cai
0fe020c208 feat: Introduce counters to count lost samples in bpf/events (#254)
* feat: Introduce counters for bpf/events

* style: rename fields
2025-01-06 16:08:27 +08:00
烈香
abf5f23b75 test: fix filter by comm test failed issue (#248)
fix filter by comm test failed issue
2025-01-05 18:23:16 +08:00
mannkafai
141c810edd user: add command-line options to set perf event buffer size (#247)
* user: add command-line  options to set perf event buffer size

add  `syscall-mapsize` , `ssl-mapsize`, `conn-mapsize`,  `kern-mapsize` command-line options to set `pageNum` of  `PullSyscallDataEvents`, `PullSslDataEvents`, `PullConnDataEvents` and `PullKernEvents`.

* user: add command-line options to set pageNum of perf event buffer

add `syscall-perf-event-map-page-num`, `ssl-perf-event-map-page-num`, `conn-perf-event-map-page-num`, `kern-perf-event-map-page-num` command-line options to set pageNum of `SyscallDataEvents`, `SslDataEvents`, `ConnDataEvents` and `KernEvents`.

* mark `*-perf-event-map-page-num` options  hidden
2025-01-05 18:22:23 +08:00
烈香
cb48df0480 fix: fix mysql protcol parser array index out of range issue and gotls load failed issue (#246)
* fix: fix gotls load failed

* fix: crash issue and gotls load failed issue
2025-01-04 00:58:31 +08:00
Spencer Cai
6d0b142054 feat: check cap privileges instead of Geteuid during starting the agent (#242)
* feat: Introduce github.com/containerd/containerd/pkg/cap to check whether process has CAP_BPF privilege

Signed-off-by: spencercjh <spencercjh@gmail.com>

* fix: better logs

* fix: adapt to e2e test env

* style: go mod tidy

* fix: make tests pass

* fix: DO NOT use containerd cap package

* test: introduce tests to verify agent/common/permission.go

* fix: correct implementation refer to https://man7.org/linux/man-pages/man2/capset.2.html

* test: test test_add_cap_bpf first

* test: cap-add difference capability for different kernal

* test: load btf file to container and run kyanos with --btf flag

* test: add missing capability CAP_SYS_RESOURCE

* test: try to use --privileged instead of cap-add

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
2025-01-03 21:05:54 +08:00
烈香
ca70f6db07 fix: use tracepoint instead of kprobe to trace skb_copy_datagram_iovec (#243) 2025-01-03 19:43:22 +08:00
烈香
a60ee5ef53 fix(test): fix filter-by-comm.test occasionally failed (#244) 2025-01-03 01:56:31 +08:00
烈香
6f6c5156c6 docs: Update README_CN.md
update wechat group qr code

Signed-off-by: 烈香 <hengyoush1@163.com>
2025-01-03 00:02:12 +08:00
hengyoush
f03195864e docs(pages): fix broken table in watch.md and format some docs 2025-01-02 23:57:52 +08:00
AS!
1c0dd7288a feat: Add json-output params to watch command (#235)
* feat: Add json-output params to watch command

* docs: modify some field explain

* docs: modify column name
2025-01-02 18:46:46 +08:00
烈香
f07909b5cc docs: add debug tips doc (#240) 2025-01-02 01:12:35 +08:00
烈香
08feac8ceb fix: handle null(/xfb) field correctly (#239) v1.4.3 2025-01-01 15:40:08 +08:00
烈香
e604005391 test: wait a longer time to ensure process exec event can be handled (#238) 2025-01-01 12:30:38 +08:00
烈香
9567bbe9af fix: server side ssl event can't be captured correctly (#236)
1. collect sendfile syscall event(nginx may send static file to client via sendfile syscall)
2. when conntrack created , transfer old connection's temp events to new conn, because some events may come in before conn created at userspace.
3. ignore recvmsg, recvfrom syscall with flags : MSG_OOB, MSG_PEEK.
2025-01-01 04:36:21 +08:00
Spencer Cai
041e8ac286 feat: introduce version cmd (#234)
* feat: add more ldflags to the goreleaser cfg for version cmd

Signed-off-by: spencercjh <spencercjh@gmail.com>

* docs: add comments

Signed-off-by: spencercjh <spencercjh@gmail.com>

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-31 17:46:49 +08:00
Spencer Cai
1434c4d3cb test: introduce a script to test flag --comm (#222) 2024-12-31 12:29:22 +08:00
烈香
78d1c633ad fix: add fallback logic to calculate totaltime when nicin event missed in server side (#232)
fix: add fallback logic to calculate totaltime when nicin event missed in server side (#232)
2024-12-31 01:02:55 +08:00
Spencer Cai
2b2b11f4b8 docs: introduce prettier and md-padding to format all docs (#221)
* docs: introduce prettier and md-padding to format docs

Signed-off-by: spencercjh <spencercjh@gmail.com>

* fix: make github alerts work

Signed-off-by: spencercjh <spencercjh@gmail.com>

* fix: make all markdown extensions work

Signed-off-by: spencercjh <spencercjh@gmail.com>

* fix: reformat new codes from main

Signed-off-by: spencercjh <spencercjh@gmail.com>

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-30 14:47:55 +08:00
烈香
1d9f0135e9 docs: add how to add a new protocol docs (#223)
* docs: add how to add a new protocol docs

* docs: add missing cn docs
2024-12-29 19:15:43 +08:00
烈香
2bfdc88f18 docs: Update README_CN.md
Signed-off-by: 烈香 <hengyoush1@163.com>
2024-12-27 12:33:03 +08:00
Spencer Cai
d22c466db2 feat: Introduce more flags to filter HTTP records (#220)
* feat: introduce path-regex and path-prefix to sub cmd http

Signed-off-by: spencercjh <spencercjh@gmail.com>

* style: reformat with goimports

Signed-off-by: spencercjh <spencercjh@gmail.com>

* fix: save FilterByRequest's result as HttpFilter's field

Signed-off-by: spencercjh <spencercjh@gmail.com>

* docs: update docs about HttpFilter

Signed-off-by: spencercjh <spencercjh@gmail.com>

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-27 11:34:55 +08:00
Herman Zhu
ab2ad807e3 build: add debugging targets and improve Makefile structure (#215)
- Introduced new Makefile targets for debugging: `dlv`, `kyanos-debug`, and `remote-debug`.
- The `dlv` target sets executable permissions and starts the debugger in headless mode.
- The `kyanos-debug` target builds the project with specific flags for debugging.
- The `remote-debug` target depends on building BPF and the `kyanos-debug` target, streamlining the debugging process.
2024-12-25 18:40:01 +08:00
hengyoush
5663995f93 docs(readme): add star history 2024-12-25 03:12:20 +08:00
烈香
7a4c410d28 fix(stat): elapsed time is negative (#213)
* fix(stat): elapsed time is negative

introduce a new option `conntrack-close-wait-time-mills` which control how long time before a
connection turn into `closed` state. If too long, new connection with same tgidfd 's data may come
into old connection  event stream or syscall data buffer. Set it  to a relatively small value  will
prevent  this situation.

* fix: add missing argument
2024-12-25 03:11:42 +08:00
xmchx
26f78aba50 update FAQ (#211)
* docs:

* update

* Update faq.md

use a more concrete case name

Signed-off-by: 烈香 <hengyoush1@163.com>

* Update faq.md

use a more concrete case name

Signed-off-by: 烈香 <hengyoush1@163.com>

---------

Signed-off-by: 烈香 <hengyoush1@163.com>
Co-authored-by: 烈香 <hengyoush1@163.com>
2024-12-24 10:52:38 +08:00
烈香
8fd22bd8c5 docs: Update README.md
Signed-off-by: 烈香 <hengyoush1@163.com>
2024-12-23 19:00:35 +08:00
xmchx
cad39e194a fix: supports container-id prefix matching with 12 or more characters (#210) 2024-12-23 13:46:10 +08:00
xmchx
280c8cd187 chore: init_env cleanup (#209) 2024-12-23 13:15:58 +08:00
烈香
b2560c6f80 Merge pull request #203 from hengyoush/renovate/actions-upload-artifact-digest
chore(deps): update actions/upload-artifact digest to 6f51ac0
2024-12-22 23:03:11 +08:00
renovate[bot]
f926ee8a22 chore(deps): update actions/upload-artifact digest to 6f51ac0 2024-12-20 18:21:26 +00:00
renovate[bot]
28c92ed8b1 fix(deps): update module github.com/charmbracelet/bubbletea to v1.2.4 (#120) 2024-12-21 02:20:51 +08:00
Spencer Cai
a883010031 feat: introduce a new workflow to verify build script on multi platforms (#196)
* feat: introduce new Check workflow

* fix: correct matrix

* fix: Make different matrices run independently of each other

* test: test init_env in the step

* style: resolve fmt issues

Signed-off-by: spencercjh <spencercjh@gmail.com>

* chore: simplify matrix

Signed-off-by: spencercjh <spencercjh@gmail.com>

* chore: rename the wf

Signed-off-by: spencercjh <spencercjh@gmail.com>

* chore: remove irrelevant codes to check format issues

Signed-off-by: spencercjh <spencercjh@gmail.com>

* fix: add missing build step

Signed-off-by: spencercjh <spencercjh@gmail.com>

* fix: add missing clang_num init biz for ubuntu 20.04

Signed-off-by: spencercjh <spencercjh@gmail.com>

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-20 22:20:19 +08:00
Spencer Cai
0cf2e387a7 feat: introduce issues Translator (#202)
Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-20 21:29:08 +08:00
烈香
4be02272ec refactor: remove fatal log (#199) 2024-12-20 02:30:50 +08:00
烈香
f384ad8821 fix: add rw lock to prevent concurrent map read write (#198)
* fix(kern_event_handler): add rw lock to prevent concurrent map read write

* fix: seperate ssl in/out locks

* fix: remove lock prevent reentrent issue
2024-12-20 00:45:54 +08:00
烈香
fe47f781b1 docs: Update README_CN.md
update wechat qrcode

Signed-off-by: 烈香 <hengyoush1@163.com>
2024-12-20 00:39:19 +08:00
Spencer Cai
c22fa13a6e chore: add .idea to the .gitignore (#195)
Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-19 17:24:52 +08:00
Spencer Cai
058cabf29c chore: make go list -m -json all works to import the project by goland (#194)
* fix: add more replace

Signed-off-by: spencercjh <spencercjh@gmail.com>

* fix: downgrade to v0.24.17

Signed-off-by: spencercjh <spencercjh@gmail.com>

---------

Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-19 17:24:21 +08:00
Spencer Cai
7d32cdef7e docs: wrong url to download the init script (#193)
Signed-off-by: spencercjh <spencercjh@gmail.com>
2024-12-19 15:55:53 +08:00
烈香
a92f83dc98 docs: add faq docs (#188)
* docs: add faq docs

* docs: modify config.mts

* docs: fix issue url

---------

Co-authored-by: root <root@localhost.localdomain>
2024-12-19 01:54:29 +08:00
烈香
f84fd438f2 feat: Print osinfo when start failed (#191)
* feat: print os info when start failed

* feat: add system info logging for crash reports

* refactor: remove unsed log

* refactor: add faq url
2024-12-19 01:54:08 +08:00
烈香
9dc5e3298c Merge pull request #190 from hengyoush/fix-compile-doc
docs: add `git submodule update ...`
2024-12-19 00:43:13 +08:00
hengyoush
84bbd3c2de docs: add git submodule update ... 2024-12-19 00:40:48 +08:00