Xray-docs-next/docs/en/config/stats.md

56 lines
1.3 KiB
Markdown
Raw Normal View History

# Traffic Statistics
2021-05-26 11:05:53 +00:00
Used to configure traffic statistics for Xray.
2021-05-26 11:05:53 +00:00
## StatsObject
The `StatsObject` corresponds to the `stats` item in the configuration file.
2021-05-26 11:05:53 +00:00
```json
{
"stats": {}
}
```
Currently, no parameters are required for traffic statistics, and internal statistics will be enabled as long as the `StatsObject` item exists.
2021-05-26 11:05:53 +00:00
After statistics are enabled, you only need to enable the corresponding items in the [Policy](./policy.md) to collect the corresponding data.
2021-05-26 11:05:53 +00:00
## Retrieving Traffic Statistics
2021-05-26 11:05:53 +00:00
You can use the `xray api` command to retrieve traffic statistics.
2021-05-26 11:05:53 +00:00
The current traffic statistics are as follows:
2021-05-26 11:05:53 +00:00
- User Data
2021-05-26 11:05:53 +00:00
- `user>>>[email]>>>traffic>>>uplink`
The uplink traffic of a specific user, in bytes.
2021-05-26 11:05:53 +00:00
- `user>>>[email]>>>traffic>>>downlink`
The downlink traffic of a specific user, in bytes.
2021-05-26 11:05:53 +00:00
::: tip
If the corresponding user does not have an email specified, statistics will not be enabled.
2021-05-26 11:05:53 +00:00
:::
- Global Data
2021-05-26 11:05:53 +00:00
- `inbound>>>[tag]>>>traffic>>>uplink`
The uplink traffic of a specific inbound, in bytes.
2021-05-26 11:05:53 +00:00
- `inbound>>>[tag]>>>traffic>>>downlink`
The downlink traffic of a specific inbound, in bytes.
2021-05-26 11:05:53 +00:00
- `outbound>>>[tag]>>>traffic>>>uplink`
The uplink traffic of a specific outbound, in bytes.
2021-05-26 11:05:53 +00:00
- `outbound>>>[tag]>>>traffic>>>downlink`
The downlink traffic of a specific outbound, in bytes.