Skip to main content

Data Charging Data Record (CDR) Format

Offline Charging for SGW-C

OmniSGW by Omnitouch Network Services


Table of Contents

  1. Overview
  2. CDR File Format
  3. CDR Fields
  4. CDR Events
  5. File Structure
  6. Configuration
  7. CDR Generation Flow
  8. Field Details
  9. Examples
  10. Integration

Overview

The Data CDR (Charging Data Record) format provides offline charging capabilities for the Serving Gateway Control Plane (SGW-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 PGW-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 CaseDescription
Offline ChargingGenerate CDRs for postpaid billing
AnalyticsAnalyze subscriber usage patterns
Audit TrailTrack all bearer session events
Capacity PlanningMonitor network resource utilization
TroubleshootingDebug 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:

  • SGW-C: /var/log/sgw_c/cdrs/

Configurable via directory parameter in the CDR reporter configuration.

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 SGW-C instance
  • Column Headers - CSV field names for the data records

CDR Fields

Field Summary

PositionField NameTypeDescription
0epochintegerEvent timestamp (Unix epoch seconds)
1imsistringInternational Mobile Subscriber Identity
2eventstringCDR event type (e.g., "default_bearer_start")
3charging_idintegerUnique charging identifier for the bearer
4msisdnstringMobile Station ISDN Number (phone number)
5ue_imeistringInternational Mobile Equipment Identity
6timezone_rawstringUE timezone (reserved, currently empty)
7plmnintegerPublic Land Mobile Network identifier
8tacintegerTracking Area Code
9eciintegerE-UTRAN Cell Identifier
10sgw_ipstringSGW-C S5/S8 control plane IP address
11ue_ipstringUE IP address (IPv4|IPv6 format)
12pgw_ipstringPGW-C S5/S8 control plane IP address
13apnstringAccess Point Name
14qciintegerQoS Class Identifier
15octets_inintegerDownlink data volume (bytes)
16octets_outintegerUplink data volume (bytes)

CDR Events

Event Types

CDRs are generated for three types of events:

Event TypeFormatDescriptionWhen Generated
Bearer Start<type>_bearer_startBearer establishmentCreate Session Response sent
Bearer Update<type>_bearer_updateUsage reporting during sessionPeriodic usage reports from user plane
Bearer End<type>_bearer_endBearer terminationDelete 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:

  1. Close current CDR file
  2. Create new file with current timestamp
  3. Write header to new file
  4. Continue recording CDRs to new file

Configuration

Configuration Parameters

ParameterTypeDescriptionDefaultRecommended
gateway_namestringSGW-C instance identifier-Use hostname or instance ID
durationintegerFile rotation interval (ms)-3600000 (1 hour)
directorystringCDR output directory path-/var/log/sgw_c/cdrs

Configuration Examples

Production:

  • gateway_name: "sgw-c-prod-01"
  • duration: 3,600,000 ms (1 hour rotation)
  • directory: "/var/log/sgw_c/cdrs"

Development:

  • gateway_name: "sgw-c-dev"
  • duration: 300,000 ms (5 minute rotation for testing)
  • directory: "/tmp/sgw_c_cdrs"

High-Volume:

  • gateway_name: "sgw-c-prod-heavy"
  • duration: 1,800,000 ms (30 minute rotation)
  • directory: "/mnt/fast-storage/cdrs"

CDR Generation Flow

Bearer Lifecycle CDR Events

SGW-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 user plane
  • Purpose: Records incremental data usage
  • octets_in: Cumulative downlink bytes since bearer start
  • octets_out: Cumulative uplink bytes since bearer start

3. Bearer End:

  • When: PFCP Session Deletion Response received (with final usage)
  • 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_start
  • default_bearer_update
  • default_bearer_end
  • dedicated_bearer_start
  • dedicated_bearer_update
  • dedicated_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:

QCIResource TypePriorityPacket DelayPacket LossExample Service
1GBR2100 ms10^-2Conversational Voice
2GBR4150 ms10^-3Conversational Video
3GBR350 ms10^-3Real-time Gaming
4GBR5300 ms10^-6Non-conversational Video
5Non-GBR1100 ms10^-6IMS Signaling
6Non-GBR6300 ms10^-6Video (buffered)
7Non-GBR7100 ms10^-3Voice, Video, Gaming
8Non-GBR8300 ms10^-6Video (buffered)
9Non-GBR9300 ms10^-6Default Bearer

Example:

9  → Default bearer (best effort)

Source: Bearer QoS parameters from PGW-C


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 SGW-U

Notes:

  • Cumulative for update events
  • Final total for end events
  • Always 0 for start events

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 SGW-U

Notes:

  • Cumulative for update events
  • Final total for end events
  • Always 0 for start events

Examples

Example 1: Basic Session with Single Update

Timeline:

  1. Bearer established
  2. 5 minutes later: Usage update (10 MB down, 5 MB up)
  3. Session terminated

CDR Output:

# Data CDR File:
# File Start Time: 10:00:00 (1726570800)
# File End Time: 11:00:00 (1726574400)
# Gateway Name: sgw-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.15,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.15,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.15,172.16.1.1|,10.0.0.20,internet,9,10485760,5242880

Example 2: Dual-Stack Session with Multiple Updates

Timeline:

  1. Dual-stack bearer established (IPv4 + IPv6)
  2. Multiple usage updates
  3. Session terminated

CDR Output:

1726570800,310260222222222,default_bearer_start,10002,15552222222,222222222222222,,349552,1001,2001,10.0.0.15,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.15,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.15,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.15,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.15,172.16.1.2|2001:db8::2,10.0.0.20,internet,9,31457280,15728640

Example 3: Session with Dedicated Bearer

Timeline:

  1. Default bearer established (QCI 9)
  2. Dedicated bearer created for video (QCI 6)
  3. Usage updates for both bearers
  4. Dedicated bearer deleted
  5. Default bearer terminated

CDR Output:

1726570800,310260333333333,default_bearer_start,10003,15553333333,333333333333333,,1258248,1002,2002,10.0.0.15,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.15,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.15,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.15,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.15,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.15,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 (SGW-C)
inotifywait -m /var/log/sgw_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/sgw_c/cdrs/* | process_cdr_stream


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)
  • TS 32.298 - CDR encoding

CDR Format - Offline Charging Records for SGW-C

Developed by Omnitouch Network Services

Documentation Version: 1.0 Last Updated: 2025-12-10