Data Charging Data Record (CDR) Format
Offline Charging for PGW-C
OmniPGW by Omnitouch Network Services
Table of Contents
- Overview
- CDR File Format
- CDR Fields
- CDR Events
- File Structure
- Configuration
- CDR Generation Flow
- Field Details
- Examples
- Integration
Overview
The Data CDR (Charging Data Record) format provides offline charging capabilities for the Packet Gateway Control Plane (PGW-C). CDRs are generated to record bearer session events, data usage, and subscriber information for billing and analytics purposes.
This common format is compatible with SGW-C CDRs, ensuring consistency in charging records across the EPC infrastructure.
Key Features
- CSV-based format - Simple, human-readable comma-separated values
- Event-based recording - Captures bearer start, update, and end events
- Volume metering - Records uplink and downlink data usage
- Automatic rotation - Configurable file rotation based on time intervals
- 3GPP compliant - Follows 3GPP TS 32.251 (PS domain charging) and TS 32.298 (CDR encoding)
Use Cases
| Use Case | Description |
|---|---|
| Offline Charging | Generate CDRs for postpaid billing |
| Analytics | Analyze subscriber usage patterns |
| Audit Trail | Track all bearer session events |
| Capacity Planning | Monitor network resource utilization |
| Troubleshooting | Debug session and bearer issues |
CDR File Format
File Naming Convention
<epoch_timestamp>
Example:
1726598022
The filename is the Unix epoch timestamp (in seconds) of when the file was created.
File Location
Default directory:
- PGW-C:
/var/log/pgw_c/cdrs/
Configurable via cdr_directory parameter in config/runtime.exs.
File Header
Each CDR file begins with a multi-line header containing metadata:
# Data CDR File:
# File Start Time: HH:MM:SS (unix_timestamp)
# File End Time: HH:MM:SS (unix_timestamp)
# Gateway Name: <gateway_name>
# epoch,imsi,event,charging_id,msisdn,ue_imei,timezone_raw,plmn,tac,eci,sgw_ip,ue_ip,pgw_ip,apn,qci,octets_in,octets_out
Header Fields:
- File Start Time - When the CDR file was created (human-readable and Unix timestamp)
- File End Time - When the file rotation will occur (human-readable and Unix timestamp)
- Gateway Name - Identifier for the PGW-C instance (configured via
pgw_nameparameter) - Column Headers - CSV field names for the data records
CDR Fields
Field Summary
| Position | Field Name | Type | Description |
|---|---|---|---|
| 0 | epoch | integer | Event timestamp (Unix epoch seconds) |
| 1 | imsi | string | International Mobile Subscriber Identity |
| 2 | event | string | CDR event type (e.g., "default_bearer_start") |
| 3 | charging_id | integer | Unique charging identifier for the bearer |
| 4 | msisdn | string | Mobile Station ISDN Number (phone number) |
| 5 | ue_imei | string | International Mobile Equipment Identity |
| 6 | timezone_raw | string | UE timezone (reserved, currently empty) |
| 7 | plmn | integer | Public Land Mobile Network identifier |
| 8 | tac | integer | Tracking Area Code |
| 9 | eci | integer | E-UTRAN Cell Identifier |
| 10 | sgw_ip | string | SGW-C S5/S8 control plane IP address |
| 11 | ue_ip | string | UE IP address (IPv4|IPv6 format) |
| 12 | pgw_ip | string | PGW-C S5/S8 control plane IP address |
| 13 | apn | string | Access Point Name |
| 14 | qci | integer | QoS Class Identifier |
| 15 | octets_in | integer | Downlink data volume (bytes) |
| 16 | octets_out | integer | Uplink data volume (bytes) |
CDR Events
Event Types
CDRs are generated for three types of events:
| Event Type | Format | Description | When Generated |
|---|---|---|---|
| Bearer Start | <type>_bearer_start | Bearer establishment | Create Session Response sent |
| Bearer Update | <type>_bearer_update | Usage reporting during session | Periodic usage reports from user plane |
| Bearer End | <type>_bearer_end | Bearer termination | Delete Session Request/Response |
Bearer Types:
default- Default bearer (one per PDN connection)dedicated- Dedicated bearer (zero or more per PDN connection)
Event Examples
default_bearer_start - Default bearer established
default_bearer_update - Default bearer usage update
default_bearer_end - Default bearer terminated
dedicated_bearer_start - Dedicated bearer established
dedicated_bearer_update - Dedicated bearer usage update
dedicated_bearer_end - Dedicated bearer terminated
File Structure
Example CDR File
# Data CDR File:
# File Start Time: 18:53:42 (1726598022)
# File End Time: 19:53:42 (1726601622)
# Gateway Name: sgw-c-prod-01
# epoch,imsi,event,charging_id,msisdn,ue_imei,timezone_raw,plmn,tac,eci,sgw_ip,ue_ip,pgw_ip,apn,qci,octets_in,octets_out
1726598022,310260123456789,default_bearer_start,12345,15551234567,123456789012345,,349552,1234,5678,10.0.0.15,172.16.1.100|2001:db8::1,10.0.0.20,internet,9,0,0
1726598322,310260123456789,default_bearer_update,12345,15551234567,123456789012345,,349552,1234,5678,10.0.0.15,172.16.1.100|2001:db8::1,10.0.0.20,internet,9,1048576,524288
1726598622,310260123456789,default_bearer_update,12345,15551234567,123456789012345,,349552,1234,5678,10.0.0.15,172.16.1.100|2001:db8::1,10.0.0.20,internet,9,5242880,2097152
1726598922,310260123456789,default_bearer_end,12345,15551234567,123456789012345,,349552,1234,5678,10.0.0.15,172.16.1.100|2001:db8::1,10.0.0.20,internet,9,10485760,5242880
File Rotation
CDR files are automatically rotated based on the configured duration:
Rotation Process:
- Close current CDR file
- Create new file with current timestamp
- Write header to new file
- Continue recording CDRs to new file
Configuration
Configuration Parameters
PGW-C CDR generation is configured in config/runtime.exs:
| Parameter | Type | Description | Default | Recommended |
|---|---|---|---|---|
pgw_name | string | PGW instance identifier (appears in CDR headers) | "omni-pgw01" | Use hostname or instance ID |
cdr_file_duration | integer | File rotation interval (ms) | 3600000 | 3600000 (1 hour) |
cdr_directory | string | CDR output directory path | "/tmp/pgw_c" | /var/log/pgw_c/cdrs |
usage_report_interval | integer | URR reporting interval (ms) - how often PGW-U sends usage reports | 60000 | 60000 (1 minute) |
Configuration Examples
Minimal Configuration (config/runtime.exs):
config :pgw_c,
# CDR file configuration
pgw_name: "omni-pgw01",
cdr_file_duration: 3_600_000, # 1 hour
cdr_directory: "/var/log/pgw_c/cdrs",
# URR configuration (triggers usage reports from PGW-U)
usage_report_interval: 60_000 # 60 seconds
Production:
config :pgw_c,
pgw_name: "pgw-c-prod-01",
cdr_file_duration: 3_600_000, # 1 hour rotation
cdr_directory: "/var/log/pgw_c/cdrs",
usage_report_interval: 60_000 # 1 minute updates
Development:
config :pgw_c,
pgw_name: "pgw-c-dev",
cdr_file_duration: 300_000, # 5 minute rotation for testing
cdr_directory: "/tmp/pgw_c_cdrs",
usage_report_interval: 30_000 # 30 second updates for faster testing
High-Volume:
config :pgw_c,
pgw_name: "pgw-c-prod-heavy",
cdr_file_duration: 1_800_000, # 30 minute rotation
cdr_directory: "/mnt/fast-storage/cdrs",
usage_report_interval: 300_000 # 5 minute updates (reduce overhead)
URR (Usage Reporting Rules)
PGW-C uses PFCP URRs (Usage Reporting Rules) to trigger usage reports from PGW-U. When a URR threshold is reached or time expires, PGW-U sends a Session Report Request containing usage data, which triggers CDR generation.
How URR Configuration Works:
usage_report_interval(in ms) is converted to seconds for PFCP time threshold- PGW-C creates URR with time threshold during session establishment
- PGW-U sends periodic usage reports at configured interval
- Each usage report triggers a
bearer_updateCDR event - Final usage report (on session deletion) triggers
bearer_endCDR event
Example: usage_report_interval: 60_000 means:
- PGW-U reports usage every 60 seconds
- CDR update events generated every 60 seconds
- Granular usage tracking for billing
URR Type Definition:
# lib/core/session/types.ex
defmodule PGW_C.Session.Types.URR do
typedstruct do
field :urr_id, non_neg_integer()
field :measurement_method, :duration | nil
field :reporting_triggers, :time_threshold | nil
field :time_threshold, non_neg_integer() | nil # seconds
end
end
See PFCP Interface Documentation for URR PFCP details and lib/core/session/impl/procedures.ex:468 for URR creation during session establishment.
CDR Generation Flow
Bearer Lifecycle CDR Events
PGW-C CDR Generation:
CDR Generation Events
1. Bearer Start:
- When: Create Session Response is sent
- Purpose: Records bearer establishment with zero usage
- octets_in: 0
- octets_out: 0
2. Bearer Update:
- When: PFCP Session Report Request received from PGW-U (URR usage report)
- Purpose: Records incremental data usage
- octets_in: Cumulative downlink bytes since bearer start
- octets_out: Cumulative uplink bytes since bearer start
- Trigger: URR time threshold expires (configured via
usage_report_interval)
3. Bearer End:
- When: PFCP Session Deletion Response received from PGW-U (with final usage report)
- Purpose: Records final data usage before session termination
- octets_in: Final total downlink bytes
- octets_out: Final total uplink bytes
Field Details
1. epoch (Timestamp)
Type: Unix epoch timestamp (seconds)
Description: The time when the CDR event occurred
Example:
1726598022 → 2025-09-17 18:53:42 UTC
2. imsi (Subscriber Identity)
Type: String (up to 15 digits)
Format: MCCMNC + MSIN
Description: International Mobile Subscriber Identity uniquely identifying the subscriber
Example:
310260123456789
└─┬─┘└─┬─┘└────┬────┘
MCC MNC MSIN
(310)(260) (123456789)
Source: UE context, received in Create Session Request
3. event (CDR Event Type)
Type: String
Format: <bearer_type>_bearer_<event>
Values:
default_bearer_startdefault_bearer_updatedefault_bearer_enddedicated_bearer_startdedicated_bearer_updatededicated_bearer_end
Determination:
- If EBI (EPS Bearer ID) equals LBI (Linked Bearer ID):
default - If EBI does not equal LBI:
dedicated
Source: Bearer context (EBI vs LBI comparison)
4. charging_id (Charging Identifier)
Type: Unsigned 32-bit integer
Description: Unique identifier for charging correlation across network elements
Example:
12345
Source: Assigned by PGW-C, received in Create Session Response
Usage:
- Correlates charging events across SGW and PGW
- Used in Diameter Gy/Gz charging interfaces
- Unique per bearer
5. msisdn (Phone Number)
Type: String (E.164 format)
Description: Mobile Station ISDN Number (subscriber's phone number)
Format: Country code + national number
Example:
15551234567
└┬┘└───┬───┘
CC National
(1) (5551234567)
Source: UE context, typically from HSS via MME
6. ue_imei (Equipment Identity)
Type: String (15 digits)
Format: TAC (8) + SNR (6) + Spare (1)
Description: International Mobile Equipment Identity (device identifier)
Example:
123456789012345
└───┬───┘└─┬─┘└┘
TAC SNR S
Source: UE context, received from MME
7. timezone_raw (UE Timezone)
Type: String (currently reserved/empty)
Description: Reserved field for UE timezone information
Current Status: Not populated (empty field in CSV)
Future Use: May include timezone offset and daylight saving time flag
Example:
, (empty field)
8. plmn (Network Identifier)
Type: Integer (legacy format)
Description: Public Land Mobile Network identifier encoded as little-endian hex
Encoding Process:
MCC: 505, MNC: 57
↓
"50557"
↓
Swap pairs: "055570"
↓
Hex to decimal: 0x055570 = 349552
Example:
349552 → MCC: 505, MNC: 57
Source: UE location information from MME
Note: This is a legacy encoding format for backward compatibility
9. tac (Tracking Area Code)
Type: Unsigned 16-bit integer
Description: Tracking Area Code identifies the tracking area where the UE is located
Range: 0 - 65535
Example:
1234
Source: UE location information, received from MME in Create Session Request
Usage:
- Identifies mobility management area
- Used for paging and location updates
- Part of TAI (Tracking Area Identity)
10. eci (E-UTRAN Cell Identifier)
Type: Unsigned 28-bit integer
Description: E-UTRAN Cell Identifier uniquely identifies the cell serving the UE
Format: eNodeB ID (20 bits) + Cell ID (8 bits)
Range: 0 - 268,435,455
Example:
5678
Source: UE location information from MME
Usage:
- Identifies specific cell tower and sector
- Used for handover and mobility management
- Granular location information
11. sgw_ip (SGW Control Plane IP)
Type: String (IPv4 or IPv6 address)
Description: SGW-C's S5/S8 control plane IP address (F-TEID)
Format: Dotted decimal (IPv4) or colon-hex (IPv6)
Example:
10.0.0.15 (IPv4)
2001:db8::15 (IPv6)
Source: Local configuration, assigned to S5/S8 interface
12. ue_ip (UE IP Address)
Type: String (IPv4|IPv6 format)
Description: IP address assigned to the UE for the PDN connection
Format: <ipv4>|<ipv6>
Examples:
172.16.1.100| (IPv4 only)
|2001:db8::1 (IPv6 only)
172.16.1.100|2001:db8::1 (Dual-stack)
Source: PDN Address Allocation (PAA) from PGW-C
Notes:
- Empty IPv4: No IPv4 address allocated
- Empty IPv6: No IPv6 address allocated
- Both present: Dual-stack PDN connection
13. pgw_ip (PGW Control Plane IP)
Type: String (IPv4 or IPv6 address)
Description: PGW-C's S5/S8 control plane IP address (remote F-TEID)
Format: Dotted decimal (IPv4) or colon-hex (IPv6)
Example:
10.0.0.20 (IPv4)
2001:db8::20 (IPv6)
Source: Received in Create Session Response from PGW-C
14. apn (Access Point Name)
Type: String (up to 100 characters)
Description: Access Point Name identifying the external network (PDN)
Format: DNS-like label format
Examples:
internet
ims
mms
enterprise.corporate
Source: Received in Create Session Request from MME
Usage:
- Determines which external network to connect to
- Drives policy and charging rules
- May determine IP address pool
15. qci (QoS Class Identifier)
Type: Unsigned 8-bit integer
Description: QoS Class Identifier defines the bearer's quality of service
Range: 1 - 9 (standardized), 128-254 (operator-specific)
Standardized QCI Values:
| QCI | Resource Type | Priority | Packet Delay | Packet Loss | Example Service |
|---|---|---|---|---|---|
| 1 | GBR | 2 | 100 ms | 10^-2 | Conversational Voice |
| 2 | GBR | 4 | 150 ms | 10^-3 | Conversational Video |
| 3 | GBR | 3 | 50 ms | 10^-3 | Real-time Gaming |
| 4 | GBR | 5 | 300 ms | 10^-6 | Non-conversational Video |
| 5 | Non-GBR | 1 | 100 ms | 10^-6 | IMS Signaling |
| 6 | Non-GBR | 6 | 300 ms | 10^-6 | Video (buffered) |
| 7 | Non-GBR | 7 | 100 ms | 10^-3 | Voice, Video, Gaming |
| 8 | Non-GBR | 8 | 300 ms | 10^-6 | Video (buffered) |
| 9 | Non-GBR | 9 | 300 ms | 10^-6 | Default Bearer |
Example:
9 → Default bearer (best effort)
Source: Bearer QoS parameters from PGW-C
16. octets_in (Downlink Volume)
Type: Unsigned 64-bit integer
Description: Number of bytes transmitted in the downlink direction (network → UE)
Units: Bytes
Example:
1048576 → 1 MB downlink
Source: PFCP Volume Measurement from PGW-U (via URR usage reports)
Notes:
- Cumulative for
updateevents - Final total for
endevents - Always 0 for
startevents - Reports triggered by URR time threshold (configured via
usage_report_interval)
17. octets_out (Uplink Volume)
Type: Unsigned 64-bit integer
Description: Number of bytes transmitted in the uplink direction (UE → network)
Units: Bytes
Example:
524288 → 512 KB uplink
Source: PFCP Volume Measurement from PGW-U (via URR usage reports)
Notes:
- Cumulative for
updateevents - Final total for
endevents - Always 0 for
startevents - Reports triggered by URR time threshold (configured via
usage_report_interval)
Examples
Example 1: Basic Session with Single Update
Timeline:
- Bearer established
- 5 minutes later: Usage update (10 MB down, 5 MB up)
- Session terminated
CDR Output:
# Data CDR File:
# File Start Time: 10:00:00 (1726570800)
# File End Time: 11:00:00 (1726574400)
# Gateway Name: pgw-c-01
# epoch,imsi,event,charging_id,msisdn,ue_imei,timezone_raw,plmn,tac,eci,sgw_ip,ue_ip,pgw_ip,apn,qci,octets_in,octets_out
1726570800,310260111111111,default_bearer_start,10001,15551111111,111111111111111,,349552,1000,2000,10.0.0.20,172.16.1.1|,10.0.0.20,internet,9,0,0
1726571100,310260111111111,default_bearer_update,10001,15551111111,111111111111111,,349552,1000,2000,10.0.0.20,172.16.1.1|,10.0.0.20,internet,9,10485760,5242880
1726571400,310260111111111,default_bearer_end,10001,15551111111,111111111111111,,349552,1000,2000,10.0.0.20,172.16.1.1|,10.0.0.20,internet,9,10485760,5242880
Example 2: Dual-Stack Session with Multiple Updates
Timeline:
- Dual-stack bearer established (IPv4 + IPv6)
- Multiple usage updates
- Session terminated
CDR Output:
1726570800,310260222222222,default_bearer_start,10002,15552222222,222222222222222,,349552,1001,2001,10.0.0.20,172.16.1.2|2001:db8::2,10.0.0.20,internet,9,0,0
1726571100,310260222222222,default_bearer_update,10002,15552222222,222222222222222,,349552,1001,2001,10.0.0.20,172.16.1.2|2001:db8::2,10.0.0.20,internet,9,2097152,1048576
1726571400,310260222222222,default_bearer_update,10002,15552222222,222222222222222,,349552,1001,2001,10.0.0.20,172.16.1.2|2001:db8::2,10.0.0.20,internet,9,8388608,4194304
1726571700,310260222222222,default_bearer_update,10002,15552222222,222222222222222,,349552,1001,2001,10.0.0.20,172.16.1.2|2001:db8::2,10.0.0.20,internet,9,20971520,10485760
1726572000,310260222222222,default_bearer_end,10002,15552222222,222222222222222,,349552,1001,2001,10.0.0.20,172.16.1.2|2001:db8::2,10.0.0.20,internet,9,31457280,15728640
Example 3: Session with Dedicated Bearer
Timeline:
- Default bearer established (QCI 9)
- Dedicated bearer created for video (QCI 6)
- Usage updates for both bearers
- Dedicated bearer deleted
- Default bearer terminated
CDR Output:
1726570800,310260333333333,default_bearer_start,10003,15553333333,333333333333333,,1258248,1002,2002,10.0.0.20,172.16.1.3|,10.0.0.20,internet,9,0,0
1726571100,310260333333333,dedicated_bearer_start,10004,15553333333,333333333333333,,1258248,1002,2002,10.0.0.20,172.16.1.3|,10.0.0.20,internet,6,0,0
1726571400,310260333333333,default_bearer_update,10003,15553333333,333333333333333,,1258248,1002,2002,10.0.0.20,172.16.1.3|,10.0.0.20,internet,9,5242880,2097152
1726571400,310260333333333,dedicated_bearer_update,10004,15553333333,333333333333333,,1258248,1002,2002,10.0.0.20,172.16.1.3|,10.0.0.20,internet,6,104857600,1048576
1726571700,310260333333333,dedicated_bearer_end,10004,15553333333,333333333333333,,1258248,1002,2002,10.0.0.20,172.16.1.3|,10.0.0.20,internet,6,209715200,2097152
1726572000,310260333333333,default_bearer_end,10003,15553333333,333333333333333,,1258248,1002,2002,10.0.0.20,172.16.1.3|,10.0.0.20,internet,9,10485760,4194304
Analysis:
- Default bearer (10003) carries background traffic (10 MB down, 4 MB up)
- Dedicated bearer (10004) carries video traffic (200 MB down, 2 MB up)
- Different QCI values (9 vs 6) reflect different QoS treatment
Integration
CDR Processing Pipeline
CDR Collection Methods
1. File-based Collection:
# Monitor CDR directory (PGW-C)
inotifywait -m /var/log/pgw_c/cdrs/ -e close_write | while read path action file; do
# File rotation completed, process CDR
process_cdr "$path$file"
done
2. Real-time Streaming:
# Tail and stream to processing pipeline
tail -F /var/log/pgw_c/cdrs/* | process_cdr_stream
Related Documentation
- Session Management - Session lifecycle and CDR triggers
- PFCP Interface - Usage reporting from PGW-U via URRs
- Monitoring Guide - CDR generation metrics and alerting
- Configuration Guide - CDR and URR configuration parameters
- Diameter Gx Interface - Policy control for QCI values in CDRs
- Diameter Gy Interface - Online charging integration
3GPP References
- TS 32.251 - Packet Switched (PS) domain charging
- TS 29.274 - 3GPP Evolved Packet System (EPS); GTP-C protocol
- TS 29.244 - Interface between CP and UP nodes (PFCP) - URR support
- TS 32.298 - CDR encoding
CDR Format - Offline Charging Records for PGW-C
Developed by Omnitouch Network Services
Documentation Version: 1.0 Last Updated: 2025-12-28