1# Platform Event Log Message Registry 2 3On the BMC, PELs are created from the standard event logs provided by 4phosphor-logging using a message registry that provides the PEL related fields. 5The message registry is a JSON file. 6 7## Contents 8 9- [Component IDs](#component-ids) 10- [Message Registry](#message-registry-fields) 11- [Modifying and Testing](#modifying-and-testing) 12 13## Component IDs 14 15A component ID is a 2 byte value of the form 0xYY00 used in a PEL to: 16 171. Provide the upper byte (the YY from above) of an SRC reason code in `BD` 18 SRCs. 192. Reside in the section header of the Private Header PEL section to specify the 20 error log creator's component ID. 213. Reside in the section header of the User Header section to specify the error 22 log committer's component ID. 234. Reside in the section header in the User Data section to specify which parser 24 to call to parse that section. 25 26Component IDs are specified in the message registry either as the upper byte of 27the SRC reason code field for `BD` SRCs, or in the standalone `ComponentID` 28field. 29 30Component IDs will be unique on a per-repository basis for errors unique to that 31repository. When the same errors are created by multiple repositories, those 32errors will all share the same component ID. The master list of component IDs is 33[here](O_component_ids.json). That file can used by PEL parsers to display a 34name for the component ID. The 'O' in the name is the creator ID value for BMC 35created PELs. 36 37## Message Registry Fields 38 39The message registry schema is [here](schema/schema.json), and the message 40registry itself is [here](message_registry.json). The schema will be validated 41either during a bitbake build or during CI, or eventually possibly both. 42 43In the message registry, there are fields for specifying: 44 45### Name 46 47This is the key into the message registry, and is the Message property of the 48OpenBMC event log that the PEL is being created from. 49 50```json 51"Name": "xyz.openbmc_project.Power.Fault" 52``` 53 54### Subsystem 55 56This field is part of the PEL User Header section, and is used to specify the 57subsystem pertaining to the error. It is an enumeration that maps to the actual 58PEL value. If the subsystem isn't known ahead of time, it can be passed in at 59the time of PEL creation using the 'PEL_SUBSYSTEM' AdditionalData field. In this 60case, 'Subsystem' isn't required, though 'PossibleSubsystems' is. 61 62```json 63"Subsystem": "power_supply" 64``` 65 66### PossibleSubsystems 67 68This field is used by scripts that build documentation from the message registry 69to know which subsystems are possible for an error when it can't be hardcoded 70using the 'Subsystem' field. It is mutually exclusive with the 'Subsystem' 71field. 72 73```json 74"PossibleSubsystems": ["memory", "processor"] 75``` 76 77### Severity 78 79This field is part of the PEL User Header section, and is used to specify the 80PEL severity. It is an optional field, if it isn't specified, then the severity 81of the OpenBMC event log will be converted into a PEL severity value. 82 83It can either be the plain severity value, or an array of severity values that 84are based on system type, where an entry without a system type will match 85anything unless another entry has a matching system type. 86 87```json 88"Severity": "unrecoverable" 89``` 90 91```json 92Severity": 93[ 94 { 95 "System": "system1", 96 "SevValue": "recovered" 97 }, 98 { 99 "Severity": "unrecoverable" 100 } 101] 102``` 103 104The above example shows that on system 'system1' the severity will be recovered, 105and on every other system it will be unrecoverable. 106 107### Mfg Severity 108 109This is an optional field and is used to override the Severity field when a 110specific manufacturing isolation mode is enabled. It has the same format as 111Severity. 112 113```json 114"MfgSeverity": "unrecoverable" 115``` 116 117### Event Scope 118 119This field is part of the PEL User Header section, and is used to specify the 120event scope, as defined by the PEL spec. It is optional and defaults to "entire 121platform". 122 123```json 124"EventScope": "entire_platform" 125``` 126 127### Event Type 128 129This field is part of the PEL User Header section, and is used to specify the 130event type, as defined by the PEL spec. It is optional and defaults to "not 131applicable" for non-informational logs, and "misc_information_only" for 132informational ones. 133 134```json 135"EventType": "na" 136``` 137 138### Action Flags 139 140This field is part of the PEL User Header section, and is used to specify the 141PEL action flags, as defined by the PEL spec. It is an array of enumerations. 142 143The action flags can usually be deduced from other PEL fields, such as the 144severity or if there are any callouts. As such, this is an optional field and if 145not supplied the code will fill them in based on those fields. 146 147In fact, even if supplied here, the code may still modify them to ensure they 148are correct. The rules used for this are 149[here](../README.md#action-flags-and-event-type-rules). 150 151```json 152"ActionFlags": ["service_action", "report", "call_home"] 153``` 154 155### Mfg Action Flags 156 157This is an optional field and is used to override the Action Flags field when a 158specific manufacturing isolation mode is enabled. 159 160```json 161"MfgActionFlags": ["service_action", "report", "call_home"] 162``` 163 164### Component ID 165 166This is the component ID of the PEL creator, in the form 0xYY00. For `BD` SRCs, 167this is an optional field and if not present the value will be taken from the 168upper byte of the reason code. If present for `BD` SRCs, then this byte must 169match the upper byte of the reason code. 170 171```json 172"ComponentID": "0x5500" 173``` 174 175### SRC Type 176 177This specifies the type of SRC to create. The type is the first 2 characters of 178the 8 character ASCII string field of the PEL. The allowed types are `BD`, for 179the standard OpenBMC error, and `11`, for power related errors. It is optional 180and if not specified will default to `BD`. 181 182Note: The ASCII string for BD SRCs looks like: `BDBBCCCC`, where: 183 184- BD = SRC type 185- BB = PEL subsystem as mentioned above 186- CCCC SRC reason code 187 188For `11` SRCs, it looks like: `1100RRRR`, where RRRR is the SRC reason code. 189 190```json 191"Type": "11" 192``` 193 194### SRC Reason Code 195 196This is the 4 character value in the latter half of the SRC ASCII string. It is 197treated as a 2 byte hex value, such as 0x5678. For `BD` SRCs, the first byte is 198the same as the first byte of the component ID field in the Private Header 199section that represents the creator's component ID. 200 201```json 202"ReasonCode": "0x5544" 203``` 204 205### SRC Symptom ID Fields 206 207The symptom ID is in the Extended User Header section and is defined in the PEL 208spec as the unique event signature string. It always starts with the ASCII 209string. This field in the message registry allows one to choose which SRC words 210to use in addition to the ASCII string field to form the symptom ID. All words 211are separated by underscores. If not specified, the code will choose a default 212format, which may depend on the SRC type. 213 214For example: ["SRCWord3", "SRCWord9"] would be: 215`<ASCII_STRING>_<SRCWord3>_<SRCWord9>`, which could look like: 216`B181320_00000050_49000000`. 217 218```json 219"SymptomIDFields": ["SRCWord3", "SRCWord9"] 220``` 221 222### SRC words 6 to 9 223 224In a PEL, these SRC words are free format and can be filled in by the user as 225desired. On the BMC, the source of these words is the AdditionalData fields in 226the event log. The message registry provides a way for the log creator to 227specify which AdditionalData property field to get the data from, and also to 228define what the SRC word means for use by parsers. If not specified, these SRC 229words will be set to zero in the PEL. 230 231```json 232"Words6to9": 233{ 234 "6": 235 { 236 "description": "Failing unit number", 237 "AdditionalDataPropSource": "PS_NUM" 238 } 239} 240``` 241 242### SRC Deconfig Flag 243 244Bit 6 in hex word 5 of the SRC means that one or more called out resources have 245been deconfigured, and this flag can be used to set that bit. The only other way 246to set it is by indicating it when 247[passing in the callouts via JSON](../README.md#callouts). 248 249This is looked at by the software that creates the periodic PELs that indicate a 250system is running with deconfigured hardware. 251 252```json 253"DeconfigFlag": true 254``` 255 256### SRC Checkstop Flag 257 258This is used to indicate the PEL is for a hardware checkstop, and causes bit 0 259in hex word 5 of the SRC to be set. 260 261```json 262"CheckstopFlag": true 263``` 264 265### Documentation Fields 266 267The documentation fields are used by PEL parsers to display a human readable 268description of a PEL. They are also the source for the Redfish event log 269messages. 270 271#### Message 272 273This field is used by the BMC's PEL parser as the description of the error log. 274It will also be used in Redfish event logs. It supports argument substitution 275using the %1, %2, etc placeholders allowing any of the SRC user data words 6 - 9 276to be displayed as part of the message. If the placeholders are used, then the 277`MessageArgSources` property must be present to say which SRC words to use for 278each placeholder. 279 280```json 281"Message": "Processor %1 had %2 errors" 282``` 283 284#### MessageArgSources 285 286This optional field is required when the Message field contains the %X 287placeholder arguments. It is an array that says which SRC words to get the 288placeholders from. In the example below, SRC word 6 would be used for %1, and 289SRC word 7 for %2. 290 291```json 292"MessageArgSources": 293[ 294 "SRCWord6", "SRCWord7" 295] 296``` 297 298#### Description 299 300A short description of the error. This is required by the Redfish schema to 301generate a Redfish message entry, but is not used in Redfish or PEL output. 302 303```json 304"Description": "A power fault" 305``` 306 307#### Notes 308 309This is an optional free format text field for keeping any notes for the 310registry entry, as comments are not allowed in JSON. It is an array of strings 311for easier readability of long fields. 312 313```json 314"Notes": [ 315 "This entry is for every type of power fault.", 316 "There is probably a hardware failure." 317] 318``` 319 320### Callout Fields 321 322The callout fields allow one to specify the PEL callouts (either a hardware FRU, 323a symbolic FRU, or a maintenance procedure) in the entry for a particular error. 324These callouts can vary based on system type, as well as a user specified 325AdditionalData property field. Callouts will be added to the PEL in the order 326they are listed in the JSON. If a callout is passed into the error, say with 327CALLOUT_INVENTORY_PATH, then that callout will be added to the PEL before the 328callouts in the registry. 329 330There is room for up to 10 callouts in a PEL. 331 332Available maintenance procedures are listed [here][1] and in the source code 333[here][2]. 334 335[1]: 336 https://github.com/ibm-openbmc/openpower-pel-parsers/blob/master/modules/calloutparsers/ocallouts/ocallouts.py 337[2]: 338 https://github.com/openbmc/phosphor-logging/blob/master/extensions/openpower-pels/pel_values.cpp 339 340If a procedure is needed that doesn't exist yet, please contact the owner of 341this code for instructions. 342 343#### Callouts example based on the system type 344 345```json 346"Callouts": 347[ 348 { 349 "System": "system1", 350 "CalloutList": 351 [ 352 { 353 "Priority": "high", 354 "LocCode": "P1-C1" 355 }, 356 { 357 "Priority": "low", 358 "LocCode": "P1" 359 } 360 ] 361 }, 362 { 363 "CalloutList": 364 [ 365 { 366 "Priority": "high", 367 "Procedure": "BMC0002" 368 } 369 ] 370 371 } 372] 373 374``` 375 376The above example shows that on system 'system1', the FRU at location P1-C1 will 377be called out with a priority of high, and the FRU at P1 with a priority of low. 378On every other system, the maintenance procedure BMC0002 is called out. 379 380#### Callouts example based on an AdditionalData field 381 382```json 383"CalloutsUsingAD": 384{ 385 "ADName": "PROC_NUM", 386 "CalloutsWithTheirADValues": 387 [ 388 { 389 "ADValue": "0", 390 "Callouts": 391 [ 392 { 393 "CalloutList": 394 [ 395 { 396 "Priority": "high", 397 "LocCode": "P1-C5" 398 } 399 ] 400 } 401 ] 402 }, 403 { 404 "ADValue": "1", 405 "Callouts": 406 [ 407 { 408 "CalloutList": 409 [ 410 { 411 "Priority": "high", 412 "LocCode": "P1-C6" 413 } 414 ] 415 } 416 ] 417 } 418 ] 419} 420 421``` 422 423This example shows that the callouts were selected based on the 'PROC_NUM' 424AdditionalData field. When PROC_NUM was 0, the FRU at P1-C5 was called out. When 425it was 1, P1-C6 was called out. Note that the same 'Callouts' array is used as 426in the previous example, so these callouts can also depend on the system type. 427 428If it's desired to use a different set of callouts when there isn't a match on 429the AdditionalData field, one can use CalloutsWhenNoADMatch. In the following 430example, the 'air_mover' callout will be added if 'PROC_NUM' isn't 0. 431'CalloutsWhenNoADMatch' has the same schema as the 'Callouts' section. 432 433```json 434"CalloutsUsingAD": 435{ 436 "ADName": "PROC_NUM", 437 "CalloutsWithTheirADValues": 438 [ 439 { 440 "ADValue": "0", 441 "Callouts": 442 [ 443 { 444 "CalloutList": 445 [ 446 { 447 "Priority": "high", 448 "LocCode": "P1-C5" 449 } 450 ] 451 } 452 ] 453 }, 454 ], 455 "CalloutsWhenNoADMatch": [ 456 { 457 "CalloutList": [ 458 { 459 "Priority": "high", 460 "SymbolicFRU": "air_mover" 461 } 462 ] 463 } 464 ] 465} 466 467``` 468 469#### CalloutType 470 471This field can be used to modify the failing component type field in the callout 472when the default doesn\'t fit: 473 474```json 475{ 476 477 "Priority": "high", 478 "Procedure": "FIXIT22" 479 "CalloutType": "config_procedure" 480} 481``` 482 483The defaults are: 484 485- Normal hardware FRU: hardware_fru 486- Symbolic FRU: symbolic_fru 487- Procedure: maint_procedure 488 489#### Symbolic FRU callouts with dynamic trusted location codes 490 491A special case is when one wants to use a symbolic FRU callout with a trusted 492location code, but the location code to use isn\'t known until runtime. This 493means it can\'t be specified using the 'LocCode' key in the registry. 494 495In this case, one should use the 'SymbolicFRUTrusted' key along with the 496'UseInventoryLocCode' key, and then pass in the inventory item that has the 497desired location code using the 'CALLOUT_INVENTORY_PATH' entry inside of the 498AdditionalData property. The code will then look up the location code for that 499passed in inventory FRU and place it in the symbolic FRU callout. The normal FRU 500callout with that inventory item will not be created. The symbolic FRU must be 501the first callout in the registry for this to work. 502 503```json 504{ 505 "Priority": "high", 506 "SymbolicFRUTrusted": "AIR_MOVR", 507 "UseInventoryLocCode": true 508} 509``` 510 511### Capturing the Journal 512 513The PEL daemon can be told to capture pieces of the journal in PEL UserData 514sections. This could be useful for debugging problems where a BMC dump which 515would also contain the journal isn't available. 516 517The 'JournalCapture' field has two formats, one that will create one UserData 518section with the previous N lines of the journal, and another that can capture 519any number of journal snippets based on the journal's SYSLOG_IDENTIFIER field. 520 521```json 522"JournalCapture": { 523 "NumLines": 30 524} 525``` 526 527```json 528"JournalCapture": 529{ 530 "Sections": [ 531 { 532 "SyslogID": "phosphor-bmc-state-manager", 533 "NumLines": 20 534 }, 535 { 536 "SyslogID": "phosphor-log-manager", 537 "NumLines": 15 538 } 539 ] 540} 541``` 542 543The first example will capture the previous 30 lines from the journal into a 544single UserData section. 545 546The second example will create two UserData sections, the first with the most 547recent 20 lines from phosphor-bmc-state-manager, and the second with 15 lines 548from phosphor-log-manager. 549 550If a UserData section would make the PEL exceed its maximum size of 16KB, it 551will be dropped. 552 553## Modifying and Testing 554 555The general process for adding new entries to the message registry is: 556 5571. Update message_registry.json to add the new errors. 5582. If a new component ID is used (usually the first byte of the SRC reason 559 code), document it in O_component_ids.json. 5603. Validate the file. It must be valid JSON and obey the schema. The 561 `validate_registry.py` script in `extensions/openpower-pels/registry/tools` 562 will validate both, though it requires the python-jsonschema package to do 563 the schema validation. This script is also run to validate the message 564 registry as part of CI testing. 565 566 ```sh 567 ./tools/validate_registry.py -s schema/schema.json -r message_registry.json 568 ``` 569 5704. One can test what PELs are generated from these new entries without writing 571 any code to create the corresponding event logs: 572 573 1. Copy the modified message_registry.json into `/etc/phosphor-logging/` on 574 the BMC. That directory may need to be created. 575 2. Use busctl to call the Create method to create an event log corresponding 576 to the message registry entry under test. 577 578 ```sh 579 busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging \ 580 xyz.openbmc_project.Logging.Create Create ssa{ss} \ 581 xyz.openbmc_project.Common.Error.Timeout \ 582 xyz.openbmc_project.Logging.Entry.Level.Error 1 "TIMEOUT_IN_MSEC" "5" 583 ``` 584 585 3. Check the PEL that was created using peltool. 586 4. When finished, delete the file from `/etc/phosphor-logging/`. 587