[systemd-devel] order of sd_journal_query_unique()?

Chris Morgan chmorgan at gmail.com
Fri Mar 6 13:13:06 PST 2015

On Fri, Mar 6, 2015 at 2:38 PM, Daurnimator <quae at daurnimator.com> wrote:
> On 6 March 2015 at 14:25, Chris Morgan <chmorgan at gmail.com> wrote:
>> I was using a journal iterator to search from the newest journal entry
>> backwards for a matching field, using SD_JOURNAL_FOREACH_BACKWARDS.
>> This appears to be pretty slow but journalctl is really fast. I went
>> looking and found sd_journal_query_unique() (although I'm not 100%
>> positive this is why journalctl is faster).
>> Looking at http://www.freedesktop.org/software/systemd/man/sd_journal_query_unique.html
>> there isn't any mention of ordering or direction.
>> Is this search finding journal entries that are newest to oldest or???
> sd_journal_query_unique() finds unique *field names*.
> Not journal entries.


So is SD_JOURNAL_FOREACH_BACKWARDS the fastest way to find the newest
journal entry with a given field? journalctl seems a ton faster than
my c application is when I search for a given field that is not
present. And by search I'm doing:

journalctl --user BLAH=1


More information about the systemd-devel mailing list