cx-rum
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRUM Querying Skill
RUM查询技能
Query and analyze Coralogix Real User Monitoring data using the command with DataPrime syntax.
cx logs使用命令结合DataPrime语法查询和分析Coralogix真实用户监控数据。
cx logsUnderstanding RUM in Coralogix
了解Coralogix中的RUM
RUM captures real user interactions from browsers and mobile apps - errors, performance metrics, network requests, web vitals, and user interactions. RUM data is stored as regular logs in the subsystem, queried with the same command and DataPrime syntax used for any other logs.
cx_rumcx logsThis means:
- Metadata () and labels (
$m.*) work the same as regular logs - you can filter on timestamp, severity, etc.$l.* - User data () contains all RUM-specific fields - event types, errors, sessions, web vitals, interactions, and more. See the RUM Fields Reference for the complete field catalog.
$d.cx_rum.* - Session replay and session flows are not available - only individual RUM log events can be queried.
For general log querying concepts and field discovery, see the skill. For DataPrime query language syntax, see the skill.
cx-query-logscx-dataprimeRUM捕获来自浏览器和移动应用的真实用户交互数据——包括错误、性能指标、网络请求、Web Vitals和用户交互。RUM数据以常规日志形式存储在子系统中,可以使用与其他日志相同的命令和DataPrime语法进行查询。
cx_rumcx logs这意味着:
- **元数据()和标签(
$m.*)**的使用方式与常规日志一致——你可以按时间戳、严重程度等进行过滤。$l.* - 用户数据()包含所有RUM特定字段——事件类型、错误、会话、Web Vitals、交互等。完整的字段目录请参阅RUM字段参考。
$d.cx_rum.* - 不支持会话重放和会话流——仅可查询单个RUM日志事件。
关于常规日志查询概念和字段发现,请参阅**技能。关于DataPrime查询语言语法,请参阅**技能。
cx-query-logscx-dataprimeCLI Command
CLI命令
bash
cx logs '<dataprime_query>'The prefix is automatically injected if the query doesn't already include a command.
source logssourcebash
cx logs '<dataprime_query>'如果查询中未包含命令,系统会自动注入前缀。
sourcesource logsOptions
选项
| Flag | Default | Description |
|---|---|---|
| | Start time (ISO 8601 or relative, e.g. |
| | End time |
| | Maximum number of results |
| | Storage tier: |
| | Output format: |
Note: Use (or wider) for web vitals and page performance queries. Short time ranges produce unreliable percentiles - low-traffic pages have too few data points.
--start now-7d| 标识 | 默认值 | 描述 |
|---|---|---|
| | 开始时间(ISO 8601格式或相对时间,例如 |
| | 结束时间 |
| | 最大结果数量 |
| | 存储层级: |
| | 输出格式: |
注意: 查询Web Vitals和页面性能数据时,请使用(或更长时间范围)。短时间范围会导致百分位数数据不可靠——低流量页面的数据点过少。
--start now-7dRUM Data Model
RUM数据模型
Identifying RUM Logs
识别RUM日志
Every RUM query must include .
$l.subsystemname == 'cx_rum'Application filtering in RUM uses dedicated fields - does not map to the RUM application name:
$l.applicationnamebash
undefined所有RUM查询必须包含。
$l.subsystemname == 'cx_rum'RUM中的应用过滤使用专用字段——并不对应RUM应用名称:
$l.applicationnamebash
undefinedRUM application name
RUM应用名称
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.version_metadata.app_name == 'my-app'"
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.version_metadata.app_name == 'my-app'"
Micro-frontend app label
微前端应用标签
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.labels.mfeApp == 'my-app'"
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.labels.mfeApp == 'my-app'"
WRONG - $l.applicationname is not the RUM application name
错误示例 - $l.applicationname不是RUM应用名称
cx logs "filter $l.subsystemname == 'cx_rum' && $l.applicationname == 'my-app'"
undefinedcx logs "filter $l.subsystemname == 'cx_rum' && $l.applicationname == 'my-app'"
undefinedEvent Types
事件类型
Filter by :
$d.cx_rum.event_context.type| Type | Description |
|---|---|
| Errors, unhandled exceptions, crashes (browser and mobile) |
| Resource loading (scripts, images, CSS, fonts) |
| XHR/Fetch HTTP requests |
| Clicks, inputs, scrolls |
| Web Vitals: |
| Long tasks blocking the main thread |
| Page lifecycle events (load, unload, visibility) |
| DOM mutations and changes |
| Console logs captured by the SDK |
| Custom metrics sent by the app |
| Mobile-specific performance metrics |
通过进行过滤:
$d.cx_rum.event_context.type| 类型 | 描述 |
|---|---|
| 错误、未处理异常、崩溃(浏览器和移动端) |
| 资源加载(脚本、图片、CSS、字体) |
| XHR/Fetch HTTP请求 |
| 点击、输入、滚动操作 |
| Web Vitals指标: |
| 阻塞主线程的长任务 |
| 页面生命周期事件(加载、卸载、可见性变化) |
| DOM变更操作 |
| SDK捕获的控制台日志 |
| 应用发送的自定义指标 |
| 移动端特定性能指标 |
Key Fields
关键字段
All RUM fields live under . The most commonly used:
$d.cx_rum.*| Context | Key Fields | Used For |
|---|---|---|
| | Filtering by event type and errors |
| Error fingerprint | Grouping errors into distinct issues |
| | Error details |
| | User/session identity |
| | App filtering (use instead of |
| | Page identification |
| | HTTP request analysis |
| | Performance metrics |
| | Click/input analysis |
| | Micro-frontend identification |
For the complete field reference including resource context, mobile contexts, and all sub-fields, see RUM Fields Reference.
所有RUM字段都位于下,最常用的字段如下:
$d.cx_rum.*| 上下文 | 关键字段 | 用途 |
|---|---|---|
| | 按事件类型和错误过滤 |
| 错误指纹 | 将相似错误事件分组为不同问题 |
| | 错误详情 |
| | 用户/会话身份识别 |
| | 应用过滤(替代 |
| | 页面识别 |
| | HTTP请求分析 |
| | 性能指标分析 |
| | 点击/输入操作分析 |
| | 微前端识别 |
包含资源上下文、移动端上下文及所有子字段的完整字段参考,请参阅**RUM字段参考**。
Error Detection
错误检测
RUM errors can come from multiple event types (, , ). The universal error marker is , which applies regardless of event type.
errornetwork-requestcustom-logevent_context.severity == 5The field groups similar error events into distinct issues - always group by it when analyzing errors, and filter out nulls:
rum_template_idbash
cx logs "filter \$l.subsystemname == 'cx_rum' && \$d.cx_rum.event_context.severity:num == 5 && \$d.cx_rum.rum_template_id != null | groupby \$d.cx_rum.rum_template_id aggregate count() as error_count, any_value(\$d.cx_rum.version_metadata.app_name) as app_name, any_value(\$d.cx_rum.event_context.type) as event_type, any_value(\$d.cx_rum.error_context.error_message) as error_message, any_value(\$d.cx_rum.network_request_context.method) as method, any_value(\$d.cx_rum.network_request_context.fragments) as url_fragments, any_value(\$d.cx_rum.network_request_context.status_code) as status_code, any_value(\$d.cx_rum.custom_log_context.message) as custom_log_message, distinct_count(\$d.cx_rum.session_context.user_id) as affected_users | orderby error_count desc" --start now-7dInclude for descriptive fields from all error types - irrelevant fields will be null. When composing error descriptions from grouped results, the relevant fields depend on the event type:
any_value()- →
errorerror_message - →
network-request"<method> <url_fragments> (status <status_code>)" - →
custom-logcustom_log_context.message
RUM错误可来自多种事件类型(、、)。通用错误标记为,适用于所有事件类型。
errornetwork-requestcustom-logevent_context.severity == 5rum_template_idbash
cx logs "filter \$l.subsystemname == 'cx_rum' && \$d.cx_rum.event_context.severity:num == 5 && \$d.cx_rum.rum_template_id != null | groupby \$d.cx_rum.rum_template_id aggregate count() as error_count, any_value(\$d.cx_rum.version_metadata.app_name) as app_name, any_value(\$d.cx_rum.event_context.type) as event_type, any_value(\$d.cx_rum.error_context.error_message) as error_message, any_value(\$d.cx_rum.network_request_context.method) as method, any_value(\$d.cx_rum.network_request_context.fragments) as url_fragments, any_value(\$d.cx_rum.network_request_context.status_code) as status_code, any_value(\$d.cx_rum.custom_log_context.message) as custom_log_message, distinct_count(\$d.cx_rum.session_context.user_id) as affected_users | orderby error_count desc" --start now-7d为所有错误类型的描述性字段使用——不相关字段将显示为空。从分组结果生成错误描述时,相关字段取决于事件类型:
any_value()- →
errorerror_message - →
network-request"<method> <url_fragments> (状态码 <status_code>)" - →
custom-logcustom_log_context.message
Querying RUM Data
查询RUM数据
Essential Examples
基础示例
bash
undefinedbash
undefinedAll RUM errors in the last 7 days
过去7天内的所有RUM错误
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.severity:num == 5" --start now-7d
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.severity:num == 5" --start now-7d
Network request errors
网络请求错误
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.severity:num == 5 && $d.cx_rum.event_context.type == 'network-request' | groupby $d.cx_rum.rum_template_id aggregate count() as error_count, any_value($d.cx_rum.network_request_context.method) as method, any_value($d.cx_rum.network_request_context.fragments) as fragments, any_value($d.cx_rum.network_request_context.status_code) as status_code | orderby error_count desc" --start now-7d
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.severity:num == 5 && $d.cx_rum.event_context.type == 'network-request' | groupby $d.cx_rum.rum_template_id aggregate count() as error_count, any_value($d.cx_rum.network_request_context.method) as method, any_value($d.cx_rum.network_request_context.fragments) as fragments, any_value($d.cx_rum.network_request_context.status_code) as status_code | orderby error_count desc" --start now-7d
Slow loading pages (LT p75)
加载缓慢的页面(LT p75分位数)
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.type == 'web-vitals' && $d.cx_rum.web_vitals_context.name == 'LT' | groupby $d.cx_rum.page_context.page_fragments aggregate distinct_count($d.cx_rum.session_context.user_id:string) as users, percentile(0.75, $d.cx_rum.web_vitals_context.value) as LT_p75_ms | orderby users desc" --start now-7d
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.type == 'web-vitals' && $d.cx_rum.web_vitals_context.name == 'LT' | groupby $d.cx_rum.page_context.page_fragments aggregate distinct_count($d.cx_rum.session_context.user_id:string) as users, percentile(0.75, $d.cx_rum.web_vitals_context.value) as LT_p75_ms | orderby users desc" --start now-7d
User interactions on a page
某页面上的用户交互
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.type == 'user-interaction' && $d.cx_rum.page_context.page_fragments ~ '/some/page' && $d.cx_rum.interaction_context.target_element_inner_text != null && $d.cx_rum.interaction_context.target_element_inner_text != '' | groupby $d.cx_rum.interaction_context.target_element_inner_text aggregate count() as click_count, distinct_count($d.cx_rum.session_context.user_id) as unique_users | orderby click_count desc" --start now-7d
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.type == 'user-interaction' && $d.cx_rum.page_context.page_fragments ~ '/some/page' && $d.cx_rum.interaction_context.target_element_inner_text != null && $d.cx_rum.interaction_context.target_element_inner_text != '' | groupby $d.cx_rum.interaction_context.target_element_inner_text aggregate count() as click_count, distinct_count($d.cx_rum.session_context.user_id) as unique_users | orderby click_count desc" --start now-7d
Affected users per error
每个错误影响的用户数
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.severity:num == 5 && $d.cx_rum.rum_template_id != null | groupby $d.cx_rum.rum_template_id aggregate distinct_count($d.cx_rum.session_context.user_id) as affected_users, count() as error_count, any_value($d.cx_rum.error_context.error_message) as error_message | orderby affected_users desc" --start now-7d
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.severity:num == 5 && $d.cx_rum.rum_template_id != null | groupby $d.cx_rum.rum_template_id aggregate distinct_count($d.cx_rum.session_context.user_id) as affected_users, count() as error_count, any_value($d.cx_rum.error_context.error_message) as error_message | orderby affected_users desc" --start now-7d
LCP by page
按页面统计LCP指标
cx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.type == 'web-vitals' && $d.cx_rum.web_vitals_context.name == 'LCP' | groupby $d.cx_rum.page_context.page_fragments aggregate percentile(0.75, $d.cx_rum.web_vitals_context.value) as LCP_p75_ms, count() as samples | orderby LCP_p75_ms desc" --start now-7d
undefinedcx logs "filter $l.subsystemname == 'cx_rum' && $d.cx_rum.event_context.type == 'web-vitals' && $d.cx_rum.web_vitals_context.name == 'LCP' | groupby $d.cx_rum.page_context.page_fragments aggregate percentile(0.75, $d.cx_rum.web_vitals_context.value) as LCP_p75_ms, count() as samples | orderby LCP_p75_ms desc" --start now-7d
undefinedWeb Vitals Querying
Web Vitals查询
Web vitals use for p75 values - is skewed by outliers. Use without cast.
percentile(0.75, ...)avg$d.cx_rum.web_vitals_context.value:numOnly query the specific vitals the user asks about. For "loading times" query , for "LCP" query . Include all vitals only when the user explicitly asks for a full overview.
LTLCPFor multiple vitals in one query, use conditional inside percentile:
if()bash
cx logs "filter \$l.subsystemname == 'cx_rum' && \$d.cx_rum.event_context.type == 'web-vitals' | groupby \$d.cx_rum.page_context.page_fragments aggregate percentile(0.75, if(\$d.cx_rum.web_vitals_context.name == 'LT', \$d.cx_rum.web_vitals_context.value)) as LT_p75, percentile(0.75, if(\$d.cx_rum.web_vitals_context.name == 'LCP', \$d.cx_rum.web_vitals_context.value)) as LCP_p75" --start now-7dWeb Vitals指标使用获取p75值——平均值会受异常值影响。使用时无需添加类型转换。
percentile(0.75, ...)$d.cx_rum.web_vitals_context.value:num仅查询用户明确询问的特定指标。若用户问“加载时间”则查询,问“LCP”则查询。仅当用户明确要求完整概览时,才包含所有指标。
LTLCP如需在一个查询中获取多个指标,可在percentile中使用条件:
if()bash
cx logs "filter \$l.subsystemname == 'cx_rum' && \$d.cx_rum.event_context.type == 'web-vitals' | groupby \$d.cx_rum.page_context.page_fragments aggregate percentile(0.75, if(\$d.cx_rum.web_vitals_context.name == 'LT', \$d.cx_rum.web_vitals_context.value)) as LT_p75, percentile(0.75, if(\$d.cx_rum.web_vitals_context.name == 'LCP', \$d.cx_rum.web_vitals_context.value)) as LCP_p75" --start now-7dUser Interaction Querying
用户交互查询
User interaction queries should always aggregate results - raw interaction events are noisy. Group by (the button/link text the user sees), and filter out null/empty values.
interaction_context.target_element_inner_textDo not group by (HTML tag like DIV, SPAN) or - these are not meaningful to users. The correct field prefix is , not .
target_elementtarget_selectorinteraction_contextuser_interaction_context用户交互查询应始终对结果进行聚合——原始交互事件数据噪音较大。按(用户看到的按钮/链接文本)分组,并过滤掉空值或空字符串。
interaction_context.target_element_inner_text不要按(HTML标签如DIV、SPAN)或分组——这些对用户无实际意义。正确的字段前缀是,而非。
target_elementtarget_selectorinteraction_contextuser_interaction_contextNetwork Requests
网络请求
Filter network requests by event type . For failed requests, combine with . Compose descriptions as .
$d.cx_rum.event_context.type == 'network-request'event_context.severity:num == 5"<method> <fragments> (status <status_code>)"通过事件类型过滤网络请求。如需筛选失败请求,可结合。描述格式应为。
$d.cx_rum.event_context.type == 'network-request'event_context.severity:num == 5"<method> <fragments> (状态码 <status_code>)"Page Performance
页面性能
Use the (Load Time) web vital for page loading time questions. Group by (not ), and include user count for context with .
LT$d.cx_rum.page_context.page_fragmentspage_urldistinct_count($d.cx_rum.session_context.user_id:string) as users回答页面加载时间相关问题时,使用(加载时间)Web Vitals指标。按(而非)分组,并通过添加用户数量作为上下文信息。
LT$d.cx_rum.page_context.page_fragmentspage_urldistinct_count($d.cx_rum.session_context.user_id:string) as usersTroubleshooting
故障排除
If a query returns no results, change one thing at a time:
- Extend the time range: or
--start now-7d--start now-30d - Relax filters: remove the most restrictive condition
- Verify field names: run a sample query with to inspect actual fields
-o json - Try archive tier: for older data
--tier archive --start now-30d
Note: Filtering by fields will show only RUM/frontend logs and hide backend logs. This is expected when analyzing RUM data.
cx_rum若查询无结果,请每次只修改一个条件:
- 扩大时间范围:使用或
--start now-7d--start now-30d - 放宽过滤条件:移除最严格的过滤规则
- 验证字段名称:运行带参数的示例查询,检查实际字段
-o json - 尝试归档层级:使用查询旧数据
--tier archive --start now-30d
注意: 按字段过滤将仅显示RUM/前端日志,隐藏后端日志。这是分析RUM数据时的预期行为。
cx_rumReferences
参考资料
- RUM Fields Reference - Complete field reference for all RUM contexts (session, network, web vitals, mobile, etc.)
- skill - General log querying, field discovery, investigation workflows, wildfind policy
cx-query-logs - skill - Full query language reference: commands, operators, aggregations, text extraction, type conversions
cx-dataprime
For inline DataPrime help:
bash
cx dataprime list # List all commands and functions
cx dataprime show filter # Detailed help for a specific command- RUM字段参考 - 所有RUM上下文(会话、网络、Web Vitals、移动端等)的完整字段参考
- 技能 - 常规日志查询、字段发现、调查流程、wildfind策略
cx-query-logs - 技能 - 完整查询语言参考:命令、运算符、聚合、文本提取、类型转换
cx-dataprime
如需DataPrime在线帮助:
bash
cx dataprime list # 列出所有命令和函数
cx dataprime show filter # 查看特定命令的详细帮助Related Skills
相关技能
- - General log querying with DataPrime (RUM data is logs)
cx-query-logs - - Distributed traces and service latency
cx-query-spans - - Aggregated counters, gauges, and histograms (PromQL)
cx-metrics-query - - Gateway skill for choosing the right data source
cx-telemetry-querying - - Create and manage alerts based on log patterns
cx-alerts
- - 使用DataPrime进行常规日志查询(RUM数据属于日志)
cx-query-logs - - 分布式追踪和服务延迟分析
cx-query-spans - - 聚合计数器、仪表盘和直方图(PromQL)
cx-metrics-query - - 选择正确数据源的网关技能
cx-telemetry-querying - - 基于日志模式创建和管理告警
cx-alerts