Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Fdata-layer%2Fdefault-dataspace%2Fai-raw-openai-codex-analytics-logs.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Fdata-layer%2Fdefault-dataspace%2Fai-raw-openai-codex-analytics-logs.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `ai.raw.openai.codex.analytics_logs`

Note

This dataset is restricted by default: no one can read its data until access is granted through a target group rule on its access policy. To grant access, see [Access control](https://coralogix.com/docs/user-guides/data-layer/dataset-management/access-control.md).

## Purpose[​](#purpose "Direct link to Purpose")

The `ai.raw.openai.codex.analytics_logs` dataset stores the daily Codex analytics that the [OpenAI integration](https://coralogix.com/docs/integrations/ai-observability/openai.md) pulls for each ChatGPT workspace. Use it to see Codex adoption and spend per user, and how Codex code review is used across your pull requests.

`ai.raw.openai.codex.analytics_logs` is a [predefined dataset](https://coralogix.com/docs/user-guides/data-layer/default-dataspace/predefined-datasets.md): Coralogix provisions it in the `default` dataspace, and your OpenAI integration fills it. Its entity type is `rawOpenAiCodexAnalyticsLogs`.

## What one event is[​](#what-one-event-is "Direct link to What one event is")

Each event is one row from one Codex analytics report, covering one day. The `stream` field names the report, and `data` holds the row.

| Field                              | Description                                                                                                                                                                                                                     |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `stream`                           | The report: `openai.analytics.codex_usage`, `openai.analytics.codex_code_reviews`, or `openai.analytics.codex_code_review_responses`.                                                                                           |
| `data.start_time`, `data.end_time` | The day the row covers, as Unix timestamps.                                                                                                                                                                                     |
| `resource.attributes`              | Integration metadata: `service.name`, `cx.application.name`, `cx.subsystem.name`, `cx.integration.source.type`, `cx.integration.source.version`, `organization` (when an Admin API key is also configured), and `workspace_id`. |

Events are timestamped when Coralogix collects them, 1 to 5 days after the day they cover. The day itself is in `data.start_time`; filter and group on it, not on the event time.

### Codex usage[​](#codex-usage "Direct link to Codex usage")

One row per user per day, plus one row per workspace per day with no user (`data.user_id` is null) for Codex code review on GitHub. Each day is written again on every daily poll for the next 4 days as OpenAI fills in late values, so keep the latest copy per `resource.attributes.workspace_id`, `data.user_id`, and `data.start_time`. Coralogix lifts the daily totals to the top level of `data` and adds a few derived fields.

| Field                                                                                                                   | Description                                                                      |
| ----------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `data.user_id`, `data.user_email`                                                                                       | The user the row describes. Null on the per-workspace Codex code review rows.    |
| `data.threads`, `data.turns`                                                                                            | Codex threads and turns for the day.                                             |
| `data.credits`                                                                                                          | Credits consumed.                                                                |
| `data.estimated_cost_usd`                                                                                               | Estimated cost in USD. Absent when OpenAI doesn't return it.                     |
| `data.uncached_text_input_tokens`, `data.cached_text_input_tokens`, `data.text_output_tokens`, `data.text_total_tokens` | Token counts.                                                                    |
| `data.clients`, `data.clients_count`                                                                                    | Per-client breakdown, for example Codex CLI, and the number of clients used.     |
| `data.models`, `data.models_count`                                                                                      | Per-model breakdown and the number of models used.                               |
| `data.lines_added`, `data.lines_removed`                                                                                | Lines of code attributed to Codex. Present when OpenAI returns code attribution. |

### Code reviews[​](#code-reviews "Direct link to Code reviews")

`openai.analytics.codex_code_reviews` rows count the day's Codex pull request reviews and comments, for example `pull_request_reviews`, `comments`, and `comment_details` by priority. `openai.analytics.codex_code_review_responses` rows describe how reviews were answered. Coralogix stores both as OpenAI returns them.

## Query the dataset[​](#query-the-dataset "Direct link to Query the dataset")

```
source ai.raw.openai.codex.analytics_logs

| filter $d.stream == 'openai.analytics.codex_usage' && $d.data.user_id != null

| groupby $d.resource.attributes.workspace_id as workspace_id, $d.data.user_id as user_id, $d.data.start_time as day aggregate max_by($m.timestamp, $d.data.credits) as credits, any_value($d.data.user_email) as user_email

| groupby user_email aggregate sum(credits) as credits
```

## Next steps[​](#next-steps "Direct link to Next steps")

* Set up the source: [OpenAI integrations](https://coralogix.com/docs/integrations/ai-observability/openai.md).
* Grant read access to more users: [Access control](https://coralogix.com/docs/user-guides/data-layer/dataset-management/access-control.md).
* See the other datasets Coralogix provisions in [Predefined datasets](https://coralogix.com/docs/user-guides/data-layer/default-dataspace/predefined-datasets.md).
