Skip to content

A Python script that parses CPER-formatted raw data contained in error event log provided by WHEA-Logger

Notifications You must be signed in to change notification settings

4k95m/cper_parser.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

CPER_parser.py

This python script parses a CPER (Common Platform Error Record) formatted raw data that is contained in an error event log provided by WHEA-Logger. You can read the CPER documentation at https://uefi.org/sites/default/files/resources/UEFI_Spec_2_2_D.pdf

This script can... (for now)

  • Parse the record header
  • Parse multiple section descriptors

This script canNOT... (for now)

  • Parse raw data of each sections

Usage

Simply run the script and copy/paste the raw data you want to read.

Disclaimer

The script has been tested with CPER from my own event logs and CPER that were posted on the internet. At this moment, the script is still incomplete and is only capable of parsing the record header and section descriptors. Although I will try my best to implement a parsing function for raw data of each section, I cannot guarantee the completion.
Also, please be aware that the parse result may contain inaccurate results. It is highly recommended that you check the result by yourself.
Feedbacks are very much welcome.

Output Example

$ python cper_parser.py  
CPER Raw data parser

CPER Raw data: 435045521002FFFFFFFF03000200000002000000680300000B060A00070115140000000000000000000000000000000000000000000000000000000000000000BDC407CF89B7184EB3C41F732CB57131B248949139377F4BA8F1E0062805C2A377C6CF4D86E2D60100000000000000000000000000000000000000000000000058010000C00000000003000001000000ADCC7698B447DB4BB65E16F193C4F3DB0000000000000000000000000000000002000000000000000000000000000000000000000000000018020000400000000003000000000000B0A03EDC44A19747B95B53FA242B6E1D0000000000000000000000000000000002000000000000000000000000000000000000000000000058020000100100000003000000000000011D1E8AF94257459C33565E5CC3F7E8000000000000000000000000000000000200000000000000000000000000000000000000000000005701000000000000000208000000000055060A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B00000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000B0000000000000055060A000008200BFFFBFA7FFFFBEBBF000000000000000000000000000000000000000000000000000000000000000002000000010000009853A8B9DCE4D6010B0000000000000000000000000000000000000000000000050001004000009000000000000000000000000000000000000000000B0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

####################
CPER Parse result

Raw data length: 872
####################


###################
[Record Header]
###################
- Signature Start   : 43504552 (CPER)
- Revision          : 1002
- Signature End     : FFFFFFFF
- Section Count     : 3
- Error Severity    : Corrected
- Validation Bits   : Valid values in: Timestamp
- Record Length     : 872
- Timestamp         : 2021/1/7 10:6:11 (UTC)
- Platform ID       : 00000000000000000000000000000000
- Partition ID      : 00000000000000000000000000000000
- Creator ID        : BDC407CF89B7184EB3C41F732CB57131
- Notification Type : B248949139377F4BA8F1E0062805C2A3
- Record ID         : 77C6CF4D86E2D601
- Flags             : 00000000
- Persistence Info  : 0000000000000000
- Reserved [ZERO]   : 000000000000000000000000


#########################
[Sections]
#########################
[Section 0]
- Section Offset    : 344
- Section Length    : 192
- Section Revision  : 0003
- Section ValidBit  : 00
- Reserved [ZERO]   : 00
- Flags             : 01000000
- Section Types     : ADCC7698B447DB4BB65E16F193C4F3DB
- FRU Id            : 00000000000000000000000000000000
- Section Severity  : Corrected
- FRU Text (Hex)    : 0000000000000000000000000000000000000000
- FRU Text (Ascii)  : 

- Section Content   : 5701000000000000000208000000000055060A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B000000000000000000000000000000000000000000000000000000000000000000000000000000



[Section 1]
- Section Offset    : 536
- Section Length    : 64
- Section Revision  : 0003
- Section ValidBit  : 00
- Reserved [ZERO]   : 00
- Flags             : 00000000
- Section Types     : B0A03EDC44A19747B95B53FA242B6E1D
- FRU Id            : 00000000000000000000000000000000
- Section Severity  : Corrected
- FRU Text (Hex)    : 0000000000000000000000000000000000000000
- FRU Text (Ascii)  : 

- Section Content   : 03000000000000000B0000000000000055060A000008200BFFFBFA7FFFFBEBBF0000000000000000000000000000000000000000000000000000000000000000



[Section 2]
- Section Offset    : 600
- Section Length    : 272
- Section Revision  : 0003
- Section ValidBit  : 00
- Reserved [ZERO]   : 00
- Flags             : 00000000
- Section Types     : 011D1E8AF94257459C33565E5CC3F7E8
- FRU Id            : 00000000000000000000000000000000
- Section Severity  : Corrected
- FRU Text (Hex)    : 0000000000000000000000000000000000000000
- FRU Text (Ascii)  : 

- Section Content   : 02000000010000009853A8B9DCE4D6010B0000000000000000000000000000000000000000000000050001004000009000000000000000000000000000000000000000000B0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000