tools: add gen-eventfilter.py
Generate event filtering code for lg2::commit from an input json
file, so that system integrators can create default filtering rules
to omit undesired events and errors from their systems.
Tested:
Used `log-create` to create an event and observed it. Modified the
default event filter as follows and saw log was not created.
```
@@ -3,6 +3,9 @@
"default": "allowed"
},
"errors": {
- "default": "allowed"
+ "default": "allowed",
+ "ids": [
+ "xyz.openbmc_project.State.SMC.SMCFailed"
+ ]
}
}
```
```
$ ./builddir/log-create xyz.openbmc_project.State.SMC.SMCFailed --json '{ "IDENTIFIER": "/xyz/openbmc_project/inventory/SomeSMC", "FAILURE_TYPE": "Timeout for the SMC" }'
```
Change-Id: Ib6041481075758b994bb27a816dbf5e9f26c2841
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/lib/lg2_commit.hpp b/lib/lg2_commit.hpp
index 1ab4302..9c76e04 100644
--- a/lib/lg2_commit.hpp
+++ b/lib/lg2_commit.hpp
@@ -20,4 +20,7 @@
-> std::tuple<std::string, Entry::Level,
std::map<std::string, std::string>>;
+bool filterEvent(const std::string&);
+bool filterError(const std::string&);
+
} // namespace lg2::details