Make journal log efficient

Journal logging currently loops over all entries to find even a single
entry.  This was reasonable at the time when bmc couldn't really store a
lot, but now that BMCs are getting significantly more flash storage,
this simplification is insufficient.  In an example system with an
AST2600, this API takes 32 seconds to respond.  This is mediocre for
obvious reasons.

This commit updates to use the sd_journal APIs to let journald do the
skipping, which can use internal details and can be a lot more
efficient.  To get the total size, bmcweb still needs to pull the
sequenceids of HEAD and TAIL to determine the complete size, but this is
still reasonable.

Tested:
Redfish service validator passes.

Various versions of top and skip return the correct result, pulling
various top sizes from 0, omitted to the limit.

https://gerrit.openbmc.org/c/openbmc/openbmc-tools/+/72975

To test all corner cases.

Change-Id: I0456bca4e037529f70eaee0bdd9191e9d5839226
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/meson.build b/meson.build
index da0036a..9ee276a 100644
--- a/meson.build
+++ b/meson.build
@@ -237,6 +237,8 @@
 bmcweb_dependencies += tinyxml
 
 systemd = dependency('systemd')
+add_project_arguments('-DSYSTEMD_VERSION=' + systemd.version(), language: 'cpp')
+
 zlib = dependency('zlib')
 bmcweb_dependencies += [systemd, zlib]