MyGit

hengyoush/kyanos

Fork: 45 Star: 2130 (更新于 2024-12-01 14:22:03)

license: Apache-2.0

Language: C .

Visualize the time packets spend in the kernel, watch & analyze in command line.

最后发布版本: v1.4.0 ( 2024-11-15 22:34:47)

官方网址 GitHub网址

kyanos

GitHub last commit GitHub release Test 简体中文 | English

Table of Contents

What is kyanos

Kyanos is an eBPF-based network issue analysis tool that enables you to capture network requests, such as HTTP, Redis, and MySQL requests.
It also helps you analyze abnormal network issues and quickly troubleshooting without the complex steps of packet capturing, downloading, and analysis.

  1. Powerful Traffic Filtering: Not only can filter based on traditional IP/port information, can also filter by process/container, L7 protocol information, request/response byte size, latency, and more.
# Filter by pid
./kyanos watch --pids 1234
# Filter by container id
./kyanos watch --container-id abc
# Filter by Redis key
./kyanos watch redis --keys my-key1,my-key2
# Filter by response byte size
./kyanos watch --resp-size 10000
  1. Advanced Analysis Capabilities : Unlike tcpdump, which only provides fine-grained packet capture, Kyanos supports aggregating captured packet metrics across various dimensions, quickly providing the critical data most useful for troubleshooting.
    Imagine if the bandwidth of your HTTP service is suddenly maxed out—how would you quickly analyze which IPs and which requests are causing it?
    With Kyanos, you just need one command: kyanos stat http --bigresp to find the largest response byte sizes sent to remote IPs and view specific data on request and response metrics.
    kyanos find big response

  2. In-Depth Kernel-Level Latency Details: In real-world, slow queries to remote services like Redis can be challenging to diagnose precisely. Kyanos provides kernel trace points from the arrival of requests/responses at the network card to the kernel socket buffer, displaying these details in a visual format. This allows you to identify exactly which stage is causing delays.

kyanos time detail

  1. Lightweight and Dependency-Free: Almost zero dependencies—just a single binary file and one command, with all results displayed in the command line.

  2. Automatic SSL Traffic Decryption : All captured requests and responses are presented in plaintext.

Examples

Capture HTTP Traffic with Latency Details

Run the command:

./kyanos watch http

The result is as follows:

kyanos quick start watch http

Capture Redis Traffic with Latency Details

Run the command:

./kyanos watch redis

The result is as follows:

kyanos quick start watch redis

Identify the Slowest Requests in the Last 5 Seconds

Run the command:

 ./kyanos stat --slow --time 5 

The result is as follows:

kyanos stat slow

❗ Requirements

Kyanos currently supports kernel versions 3.10(from 3.10.0-957) and 4.14 or above (with plans to support versions between 4.7 and 4.14 in the future).

You can check your kernel version using uname -r.

🎯 How to get kyanos

You can download a statically linked binary compatible with x86_64 and arm64 architectures from the release page:

tar xvf kyanos_vx.x.x_linux_x86.tar.gz

Then, run:

kyanos watch 

If the following table appears: kyanos quick start success 🎉 Congratulations! Kyanos has started successfully.

📝 Documentation

English Document

⚙ Usage

The simplest usage captures all protocols currently supported by Kyanos:

./kyanos watch

Each request-response record is stored as a row in a table, with each column capturing basic information about that request. You can use the arrow keys or j/k to move up and down through the records: kyanos watch result

Press Enter to access the details view:

kyanos watch result detail

In the details view, the first section shows Latency Details. Each block represents a "node" that the data packet passes through, such as the process, network card, and socket buffer.
Each block includes a time value indicating the time elapsed from the previous node to this node, showing the process flow from the process sending the request to the network card, to the response being copied to the socket buffer, and finally read by the process, with each step’s duration displayed.

The second section provides Detailed Request and Response Content, split into Request and Response parts, and truncates content over 1024 bytes.

For targeted traffic capture, such as HTTP traffic:

./kyanos watch http

You can narrow it further to capture traffic for a specific HTTP path:

./kyanos watch http --path /abc 

Learn more: Kyanos Docs

🤝 Feedback and Contributions

[!IMPORTANT] If you encounter any issues or bugs while using the tool, please feel free to ask questions in the issue tracker.

🗨️ Contacts

For more detailed inquiries, you can use the following contact methods:

Back to top

最近版本更新:(数据更新于 2024-12-02 08:46:37)

2024-11-15 22:34:47 v1.4.0

2024-09-18 14:07:17 v1.3.2

2024-09-18 01:56:45 v1.3.1

2024-09-16 20:04:39 v1.3.0

2024-09-14 03:37:16 v1.2.0

2024-09-13 00:53:02 v1.1.0

2024-09-10 02:37:15 v1.0.1

2024-09-08 22:30:22 v1.0.0

主题(topics):

bpf, capture, command-line, command-line-tool, ebpf, network, sniffer, tcp, tcpdump, tcpdump-like

hengyoush/kyanos同语言 C最近更新仓库

2024-12-17 11:04:20 EdgeTX/edgetx

2024-12-15 21:46:59 arendst/Tasmota

2024-12-13 20:23:33 XITRIX/Moonlight-Switch

2024-12-11 15:17:04 curl/curl

2024-12-07 10:42:25 libsdl-org/SDL

2024-12-05 06:52:52 openwrt/openwrt