{"remote_addr":"124.78.124.112""method":"GET""upstream_addr":"169.254.128.14:60002""upstream_response_length":"48""body_bytes_sent":"59""time_local":"2021-12-03T17:16:58+00:00""version":"HTTP/1.1""url":"/""http_user_agent":"-""remote_user":"-""req_id":"e3d1ae06b30344539bc7e28314d542fa""upstream_status":"400""request_time":"0.002""sys_address":"11.149.155.219""request_length":"40""http_referer":"-""sys_datasource":"gz.1.1.v1.2.19""proxy_upstream_name":"default-kubernetes-443""upstream_response_time":"0.000""time":"1702542388004""timestamp":"2023-12-14T16:26:28+08:00""status":"400"}
select count(*)as pv, count_if(status>=400)as bad_request_count, approx_percentile(request_time,0.99) as P99_request_time,url group by url order by pv desc limit 10

Configuration Item | Description |
Task Name | Log2Metric |
Target Topic | Select the metric topic, which should be created in advance. The name in the example is NginxMetric. |
Query statement | * | select count(*)as pv, count_if(status>=400)as bad_request_count, approx_percentile(request_time,0.99) as P99_request_time,url group by url order by pv desc limit 10 |
Preview | Click Preview. |
Metric Name | The system automatically populates the statistical metrics (numeric type) in your SQL statement: pv, bad_request_count, P99_request_time. |
Metric Dimension | Click the drop-down menu, select url, which is usually the field after group by. In the example, it means grouping and counting by URL. |
Custom Dimension | {"Author","Coder"}. Add your own dimensions, which in actual production could be your development team, application, cluster, namespace, or similar. |
Timestamp | Default (left boundary of the query time window). For example, when data for 00:00:00-00:00:01 is queried, the generated metric's timestamp will be the left boundary of the window: 00:00:00. |
Configuration Item | Description |
Duration | The data scope processed by Timer SQL. |
Scheduling cycle | 1 minute, meaning every 1 minute initiate a query and save the results to the metric topic. |
Query Time Window | Select the time expression @m-1m,@m, which means the query time range is the last 1 minute. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan