summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* PEL: Add UserHeader classMatt Spinler2019-07-267-5/+403
| | | | | | | | | | | | | The second section in a PEL is always the 'User Header' section. This commit adds a class to represent that. Right now, the only constructor available is filling in its data fields from a PEL stream. Several of the fields in this section have predefined values that are defined by the PEL specification. Defining any constants or enums for those will be left to future commits where they will actually be used. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I8b5f856a4284d44c31b04e98a664f20cd8fa0cb6
* PEL: Add PrivateHeader classMatt Spinler2019-07-268-3/+652
| | | | | | | | | | | | | The first section in a PEL is always the 'Private Header' section. This commit adds a class to represent that. Right now, the only constructor available is filling in its data fields from a PEL stream. The Section base class, which will be the base class of all PEL sections, is also being introduced here. It contains the section header structure, and a valid flag that derived classes can use. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ia5806017155fe1ef29ea57bf8ab202ff861bde2e
* PEL: Add PEL section header structureMatt Spinler2019-07-263-1/+158
| | | | | | | | | | A PEL is made up of sections, and every section has an 8B section header. This commit adds a SectionHeader structure that will represent that header. It will then be included in all upcoming PEL sections. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ia5356560f49707e21aebca28f4a0b525aa24158d
* PEL: Add BCD time helpers for PELsMatt Spinler2019-07-265-1/+241
| | | | | | | | | | | | | | | | | | | | | | | A PEL stores time in BCD, with a byte each for: * year MSB * year LSB * month * day * hour * minutes * seconds * hundredths This commit adds a structure to represent this, and functions to: * Create a BCD structure from a std::chrono::time_point * Convert any number to BCD * Write the BCD structure into a Stream * Extract a BCD structure from a Stream Refresher: The BCD value of 32 is 0x32. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I09ea4098f3a3981931f595d11fb63aff31d9fb0d
* PEL: Add Stream class to manipulate PEL dataMatt Spinler2019-07-263-1/+473
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This stream inserts data into and extracts data from the vector<uint8_t> that it is given in its contructor. That vector is how PEL data is stored. This object takes care of the endian conversion for fields that require it, as PEL data is big endian. On writes, it will expand the vector if necessary. An exception will be thrown an invalid access is attempted, such as trying to extract a value when at the end of the data. It provides >> and << operators for common data types, as well as read()/write() functions when using other types. Example: std::vector<uint8_t> data; Stream stream{data}; uin32_t value = 0x12345678; stream << value; stream.offset(0); uint32_t newValue; stream >> newValue; assert(value == newValue); uint8_t buf[3000] = {0}; stream.write(buf, 3000); Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I8dc5566371749b45a260389a564836433323eef8
* PEL: Add PEL Manager classMatt Spinler2019-07-264-3/+170
| | | | | | | | | | | This class will have the logic for how to handle PELs. It will also eventually provide D-Bus interfaces. This first commit has stubs, plus some basic code to find if a PEL is being passed in with the OpenBMC event log. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I55a5da4d2239c688fded31c112895c3c92bab56d
* PEL: Add class to wrap AdditionalDataMatt Spinler2019-07-264-0/+118
| | | | | | | | | | | | | | | | | | | | | | The AdditionalData property on the xyz.openbmc_project.Logging.Entry interface is a vector of strings of the form: "KEY=VALUE". The PEL processing code will be interested in those keys and values, and this class adds a way to get at those values based on a key without having to do string parsing each time. It returns an std::optional<std::string> value, and if the key isn't found, then the std::optional value will be empty. For Example: AdditionalData ad{additionalDataPropertyValue}; // Get the value for the FOO key std::optional<std::string> val = ad.getValue("FOO"); if (val) std::cout << (*val).size(); Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I6ba458840278784b1cc6a0ed88a7fece8794df7d
* Add libstdc++fs to test_ldflags Makefile varMatt Spinler2019-07-191-14/+8
| | | | | | | | | Every testcase that uses test_ldflags also needs that library, so just pull it in from that single place instead of in each testcase. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I1c0ccd51ae8f79a8cf2a90ddb74316537fa957e2
* Add event log section to READMEMatt Spinler2019-07-191-0/+158
| | | | | | | | Describe what event logs are how and how to create them from code. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I3f849a46a7fac1edb5965e916899c4a04333f6ca
* Update README desc and add table of contentsMatt Spinler2019-07-191-2/+8
| | | | | | | | | I plan on adding more to this document in the future so adding a table of contents. Also clarified the description to not imply everything is based on the journal. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Idc846ae0afb2dae76bb176ff1f0d879a72270c50
* PELs: Document _PID as an AdditionalData keywordMatt Spinler2019-07-191-0/+18
| | | | | | | | | | | | | | When one uses the new `Create` D-Bus API to create an event log that will be converted into a PEL, the log-manager daemon will not know the PID of the creator, unlike when the 'commit' or 'report' shared library APIs are used. Document this method for allowing the creator to pass in their PID, which they can find with getpid(), if they want their PID in an event log and in the corresponding PEL. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I0fadaed301bcd87de1d4395f6c6ec0baacfe0b97
* Add initial OpenPower PEL specific documentationMatt Spinler2019-07-192-2/+38
| | | | | | | | Add a markdown file just for PEL specific documentation starting with how to specify a raw PEL in an OpenBMC event log. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I5bde74b3f271e334dc77f42fd38ca1fef84bd29a
* Use sdeventplusMatt Spinler2019-07-164-7/+12
| | | | | | | | Start using the sdeventplus event mechanisms so that future code can take advantage of it for things like timers and other events. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I6ffe80266257bfd3512a5b848c47f5ccfb5206e8
* OpenPower PEL Extension support frameworkMatt Spinler2019-07-1613-11/+636
| | | | | | | | | | | | | | | | | | | | | | The goal of extensions is to extend phosphor-logging's `xyz.openbmc_project.Logging.Entry` log support to allow other log formats to be created without incurring extra D-Bus call overhead. The README.md change in this commit provides additional documentation on how extensions work. The summary is that they allow code that resides in this repository to provide functions that can be called at certain points (startup, log creation/deletion) such that the code can then create their own logs based on the contents of an OpenBMC log. A specific extension's code is compiled in using a --enable configure option, so platforms that did not use those log formats would incur no performance/size penalties. This commit provides the support for extensions, plus a basic OpenPower PEL (Platform Event Log) extension as the first extension. PELs are event logs used only on some OpenPower systems. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ifbb31325261c157678c29bbebc7f6d32d282582f
* log: Re-order to fix return type deductionWilliam A. Kennington III2019-07-121-60/+52
| | | | | | | | | | | The entry(...) function definition needs to come before the log function since it depends on knowing the return type of the entry it is generating. Technically this is never an issue because a concrete log(...) call is never used before entry(...) is defined, but static analyzers are unhappy about it. Change-Id: Ia784851ffed5436474d5f6a44d78343a9be8d231 Signed-off-by: William A. Kennington III <wak@google.com>
* Add myself as a maintainerMatt Spinler2019-07-021-0/+1
| | | | | | | | I am requesting maintainership for the code in the extensions directories. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Id2f9e286f7b944afcf09bf5b513a63520098fd5d
* Fix format issueMatt Spinler2019-07-021-1/+2
| | | | | | | | This has been wrong for awhile, but was only now flagged by CI on gerrit. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I2a66fe6e727922d48b77e99feeebd9d5b95f617f
* rsyslod: Change disable actionSantosh Puranik2019-05-273-40/+7
| | | | | | | | | | | | | | | | | | | | | | | | This commit changes the way remote logging is disabled. Prior to this, we would create/delete the RSYSLOG_SERVER_CONFIG_FILE to enable/disable remote logging. Deleting the file would cause systemd to spin while it tried to trigger the syslog service via socket activation. So this commit reverts commits 40a7406097c0b5b0670c5987f6fe8c902d65562d and e165ea956c5557c2b470869d252c80744227b00f and then: To disable remote logging, we now simply ask that rsyslog ignore all incoming messages. This is done by using a special '~' rule for all messages. Tested: -- Verified that systemd no longer spins while trying to activate rsyslog with default config. -- Verified that setting a remote logging server over the REST API still works. Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com> Change-Id: Ife217a84395aaf32b775b7a84f85fc6310df3e7c
* elog: Add noreturn attributeWilliam A. Kennington III2019-04-111-2/+1
| | | | | | | | | We need to signal to the compiler that elog() always throws. This allows the compiler to deduce that we have unreachable code after the elog() statement, instead of a assuming that it might be reachable. Change-Id: If6c41773d3a0dde94d44481ad6ecd719365c515a Signed-off-by: William A. Kennington III <wak@google.com>
* build: install into bin instead of sbinPatrick Venture2019-04-042-2/+2
| | | | | | | Installs into bin instead of sbin per guidelines Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I382022b4f09374132cf07232177a5145c425f758
* utils: restart: Fix restart bugWilliam A. Kennington III2019-04-031-1/+1
| | | | | | | | | bc89289f48ce5e1c8e5c66e657a176a0cd881d39 introduced a regression in the type signature of the RestartUnit call. The "replace" argument was accidentally deleted. Change-Id: I44313997b8b72b7163ad8b43ed2b45a01cb54e44 Signed-off-by: William A. Kennington III <wak@google.com>
* utils: restart: Always restart serviceWilliam A. Kennington III2019-04-011-4/+17
| | | | | | | | | | If the service has hit its reset limit in systemd, calling RestartUnit on the service will do nothing. This ensures that the service will try and restart at least once after a configuration change, regardless of whether or not it has failed in the past. Change-Id: I28962fc4ef9da641d1d19b8e09450e40d76e9c27 Signed-off-by: William A. Kennington III <wak@google.com>
* build: pkg anti-pattern: use defaultsPatrick Venture2019-02-131-2/+2
| | | | | | | | Use the defaults in the pkg check where the default error message is sufficient to identify which package is missing. Change-Id: If99dcef3cfe918a7d0926cf4fa1eb34f1b619f03 Signed-off-by: Patrick Venture <venture@google.com>
* Fix regression with e165ea9Deepak Kodihalli2019-01-141-0/+1
| | | | | | | | | Commit e165ea9 introduces creation of the remote logging config file on demand, but it presumed the directory housing this config file pre-exists. That was not the case. Change-Id: I8974ce798de5d2747bcc4a67209f4d2c8081cfe6 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rsyslogd: don't start without actionsDeepak Kodihalli2019-01-113-7/+39
| | | | | | | | | | | | | Rsyslog is currently used only for remote logging. The daemon would run though (started by systemd) even when remote logging has not been configured. In other words, it would run without any actions. With Yocto 2.6, rsyslogd won't run without any actions. Hence, rsyslogd is now started only on the condition that the remote logging config file is present. Change-Id: Iae11d6912e60765ecb774b663d44b4e3c6f381a3 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* disable journal interface call-throughPatrick Venture2019-01-031-1/+3
| | | | | | | | | | | | The pass-through isn't working as expected, therefore disable it. This patchset disables the call to the sd journal interface object and instead calls sdbus directly as it had previously. This will break any tests that pass through log<>, but that will be revisited. Change-Id: I59aa914d21405a2c5b9746d7d98958912078cc87 Signed-off-by: Patrick Venture <venture@google.com>
* test: add test to force building of sdjournal mockPatrick Venture2018-12-042-1/+24
| | | | | | | | Add test to force building of sdjournal mock. This will ensure it won't break down chain users later. Change-Id: Ida9745595af251df800ec8e98abaa39728c9ba86 Signed-off-by: Patrick Venture <venture@google.com>
* bugfix: rename method to match implementationPatrick Venture2018-12-041-1/+1
| | | | | | | | The object was renamed and the change didn't propogate. Change-Id: Ia4868b426ab187187a05bd0047ac8c7a98aa984b Signed-off-by: Patrick Venture <venture@google.com>
* bugfix: add fixes to mock classPatrick Venture2018-12-031-2/+4
| | | | | | | | | | | | | The mock class is only compiled when included. Add a missing semicolon to the class definition. The interface class was renamed, update the name from which the mock class derives. Tested: Added a local instance of the object that forces compilation. Change-Id: I65dd92e1e29d0cf0532ebe209b356d3d8fe4f1d8 Signed-off-by: Patrick Venture <venture@google.com>
* test: use only one main libraryPatrick Venture2018-12-031-1/+1
| | | | | | | Use only gtest_main or gmock_main. Change-Id: Ib6b8347560ff20d5d062baec807b1590050627c3 Signed-off-by: Patrick Venture <venture@google.com>
* add sdjournal interface to inject testsPatrick Venture2018-11-117-6/+136
| | | | | | | | The goal of the tests is not to test phosphor-logging, but rather allow code to call through phosphor-logging/log<> during a test. Change-Id: Id8c84ded473decc7f9f0be268116083093f86e54 Signed-off-by: Patrick Venture <venture@google.com>
* minor cleanup, std namespacingPatrick Venture2018-11-016-10/+17
| | | | | | | Added std namespace to places where there is a cpp version. Change-Id: I60a05a7c9cdcd79cfffc3c4968005fcbe34acf81 Signed-off-by: Patrick Venture <venture@google.com>
* add rsyslog-config to gitignorePatrick Venture2018-10-311-0/+1
| | | | | | | Add rsyslog binary to gitignore Change-Id: I6e7262e3b0b53bbfe6e0f5a391153a6943d30711 Signed-off-by: Patrick Venture <venture@google.com>
* build: phosphor-rsyslog-config: drop invalid libraryPatrick Venture2018-10-311-2/+0
| | | | | | | | | | | | | | | The line in the makefile for including the phosphor-logging isn't populated during build in neither the CI nor the obmc-phosphor-image build. "phosphor_rsyslog_conf-server-conf.o -lsdbusplus -lsystemd -lphosphor_dbus" Tested: Verified CI still builds both. Tested: Verified the build line from the compile log doesn't populate that line with any value. Change-Id: I4ec8c44d6a717f011118826149e64d2dd2c56d52 Signed-off-by: Patrick Venture <venture@google.com>
* Add test artifacts to gitignorePatrick Venture2018-10-311-0/+8
| | | | | | | | | | | Add test artifacts to .gitignore Add libtool to .gitignore Tested: Verified the * in the gitignore stops at periods, so modifying a test.cpp or test_*.cpp will still show up as a change. Change-Id: I24a449ead29fb038a9cba8c51ab1b753a8407708 Signed-off-by: Patrick Venture <venture@google.com>
* style: local variable entry shadows outer symbolPatrick Venture2018-10-303-13/+13
| | | | | | | | | | | | | | | | | Many functions have a variable entry in a sub namespace to the outer symbol entry from phosphor-logging/log.hpp [phosphor-logging/log.hpp:73] -> [log_manager.hpp:104]: (style) Local variable entry shadows outer symbol [phosphor-logging/log.hpp:73] -> [log_manager.cpp:226]: (style) Local variable entry shadows outer symbol [phosphor-logging/log.hpp:73] -> [log_manager.cpp:243]: (style) Local variable entry shadows outer symbol [phosphor-logging/log.hpp:73] -> [elog_meta.hpp:37]: (style) Local variable entry shadows outer symbol Change-Id: Icf5d585ec05b0a545e515d0afb7d2267645a2f2c Signed-off-by: Patrick Venture <venture@google.com>
* style: scope reductionPatrick Venture2018-10-301-1/+2
| | | | | | | | [elog_meta.hpp:77]: (style) The scope of the variable 'ROOT' can be reduced. Change-Id: I2511c3b1551db08e5f0eef2d71513de36eb79f80 Signed-off-by: Patrick Venture <venture@google.com>
* add .clang-formatPatrick Venture2018-10-2630-1050/+1052
| | | | | Change-Id: I2c36b7886a25d0b235693b0776019d29608e1d52 Signed-off-by: Patrick Venture <venture@google.com>
* phosphor-rsyslog-conf: react to hostname changeDeepak Kodihalli2018-10-171-1/+18
| | | | | | | | | | | | | | The rsyslog client caches the hostname when it starts up (hostname is included in logs that are streamed out). If someone changes hostname via REST API for example, the same won't reflect in rsyslog logs at the server. Listen to the hostname changed D-Bus signal from systemd, and restart rsyslogd when this happens. This ensures logs are streamed out with the updated hostname. Change-Id: Ied2b401e621314ef7c25e97dc93f86a429fb4077 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* phosphor-logging: use c++17Vernon Mauery2018-10-171-1/+1
| | | | | | | Update configure.ac to choose the c++17 standard Change-Id: Ie34c3148c7f24f3b85931644da14bba93631d74a Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* tools/elog-gen: Clean up missing error metadata messageWilliam A. Kennington III2018-10-041-1/+2
| | | | | Change-Id: I880cf6793e64db29a6eee74839f5a5bdabb1dff2 Signed-off-by: William A. Kennington III <wak@google.com>
* log_manager: Don't fail on missing synced fileAdriana Kobylak2018-09-052-11/+21
| | | | | | | | | | | | | | | | | | | | | The journald synced file is created during a journal sync, so if it's missing, the log manager should still perform the sync operation so that the synced file gets created. This is the behavior of journalctl which this function is copying, just this logic wasn't transferred in the original commit. Reference: https://github.com/systemd/systemd/blob/60118b21c6b4b29376615921c5edc1b05cde306f/src/journal/journalctl.c#L1999 Disabled the unit test cases that call commit since they now fail. Opened issue openbmc/phosphor-logging#11 for debug. Closes openbmc/phosphor-logging#10 Tested: With the synced file missing, verified that a commit operation created the file and there were no error messages about failing to open the synced file. Change-Id: Ia720741b99552d51d13cdc6b4e08dbbab58bca77 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* phosphor-rsyslog-conf: add unit testsDeepak Kodihalli2018-08-312-1/+68
| | | | | | | Add tests pertaining to remote logging config file. Change-Id: Idaeac09b5abe91af30dc0eb32664e8af556ecda2 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* phosphor-rsyslog-conf: add unit testsDeepak Kodihalli2018-08-314-1/+128
| | | | | | | Add tests related to setting remote server IP address and port. Change-Id: I35ac539a8316d34245ee6b1abcb9f48c1ebe5095 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* phoshor-rsyslog-config: wrap utils::restartDeepak Kodihalli2018-08-312-1/+10
| | | | | | | | Provide a virtual wrapper around utils::restart in class Server. This allows mocking in tests. Change-Id: I79a229eaaaa17860959b8025eb8c152362738acf Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* phosphor-rsyslog-conf: implement restoreDeepak Kodihalli2018-08-292-2/+41
| | | | | | | | Upon startup, if a remote logging config exists, relay that information into appropriate D-Bus properties. Change-Id: Ib873667a50f0c8a6af6a3b571f68d6075808ed10 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* rsyslog-conf: add validation and error handlingDeepak Kodihalli2018-08-293-10/+90
| | | | | | | Validate server IP address. Handle exceptions. Change-Id: I6da9949dbf90dd12853afca8050b68b3aaad144e Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* phosphor-ryslog-conf: add way to disable loggingDeepak Kodihalli2018-08-292-4/+27
| | | | | | | | Remote logging via rsyslog can be disabled by writing 0 to the port, or an empty string to the address. Change-Id: I50bce3ff008af1b9c488a09a2b36c01abbe5497d Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Add application to configure rsyslogDeepak Kodihalli2018-08-299-6/+270
| | | | | | | | | | | | | | The application implements the xyz.openbmc_project.Network.Client D-Bus interface to set a remote rsyslog server's address and port in the rsyslog config file. This lets us configure rsyslog to be able to stream out logs. TODO: Exception handling and validation will be handled in subsequent commits. Change-Id: I8917daab3f0de1806d2f1aafe99cb3a872f19184 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* documentation: markdown header level fixupsDeepak Kodihalli2018-08-291-24/+33
| | | | | Change-Id: I5d82f9d784e79fb52026e06bf7c0c771ddac96d6 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
OpenPOWER on IntegriCloud