Re: [systemd-devel] odd seek_tail behaviour

2014-10-24 Thread Sascha Kattelmann
Hi,

here is a related bug report: 
https://bugs.freedesktop.org/show_bug.cgi?id=64614

Doing a next after seek_tail ends up in some unexpected behaviour. Just do 
a previous after seeking the tail and everything works fine.
The problem is symmetrical: Same goes for previous after seek_head. You 
need to do a next immediately after seek_head.

I hope that will help,
Sascha

- Original Message -
From: Daurnimator q...@daurnimator.com
To: systemd Mailing List systemd-devel@lists.freedesktop.org
Sent: Monday, October 13, 2014 7:27:22 AM
Subject: [systemd-devel] odd seek_tail behaviour

Hi All, 

I was trying to write a program that tailed the journal, but found that 
sd_journal_seek_tail() didn't work as expected. 
That is: that it would seek to the last/most recent thing in the journal, and I 
could tail things from there. 

I whipped up a quick demonstration program, that shows that messages I 'next' 
through, are before the 'cutoff': 

#include stdio.h 
#include assert.h 
#include systemd/sd-journal.h 

int main() { 
sd_journal* j; 
assert(sd_journal_open(j, 0)==0); 
uint64_t from, to; 
assert(sd_journal_get_cutoff_realtime_usec(j, from, to)==1); 
printf(CUTOFF = %llu\n, to); 

printf(TAIL = %d\n, sd_journal_seek_tail(j)); 

for (int i=0; i10; i++) { 
printf(NEXT = %lld\n, sd_journal_next(j)); 
assert(sd_journal_get_realtime_usec(j, from)==0); 
printf(FOUND from %llu\n, from); 
} 
return 0; 
} 

Compiled with: gcc -std=c99 tail_logs.c -l systemd 

Example output: 

CUTOFF = 1413177397982789 
TAIL = 0 
NEXT = 1 
FOUND from 1400437372012374 
NEXT = 1 
FOUND from 1400438753925868 
NEXT = 1 
FOUND from 1400438753926192 
NEXT = 1 
FOUND from 1400438753926257 
NEXT = 1 
FOUND from 1400438753926289 
NEXT = 1 
FOUND from 1400438753926309 
NEXT = 1 
FOUND from 1400438753926330 
NEXT = 1 
FOUND from 1400438753926353 
NEXT = 1 
FOUND from 1400438753926373 
NEXT = 1 
FOUND from 1400438753926395 


Is this behaviour expected? I'm using systemd 216. 

Regards, 
Daurn. 


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] journal: How to limit the file size of runtime system.journal

2013-12-20 Thread Sascha Kattelmann


On 12/16/2013 02:30 PM, Zbigniew Jędrzejewski-Szmek wrote:

On Mon, Dec 16, 2013 at 08:31:46AM +0100, Holger Winkelmann [TP] wrote:

Hi,


Is there any particular reason? I think thresold for runtime journal
size can lower much because in initramfs it's not supposed to have much
logs.

First, there are some data strcutures which are allocated when the file
is created, and if the file was very small, relatively more space would
wasted. Second, repeated fields are not stored, just referenced, so things
become more efficient when the file is not too small. But neither is
fundamental reason, and with some tweaking the journal could be made
to work much smaller files.

I understand. These are really good points when logs are relatively
large, ie. the journal is stored on a real disk.

However when it's in initramfs context, journal is stored in tmpfs which
is using the real memory resource as it's backend. 4 MB seems a little
bit overkill especially when memory is quite limited case, like kdump.
To be more specific, I think 512 KB or 1 MB is a fairly large enough
nubmer when journal is stored to a volatile backend.

We totally agree that a minimum size must be below 1MB either on flash or
ramfs for embedded devices. otherwise you end up with two solutions for smaller
and bigger devices. Is there any reference about the overhead if you use smaller
file size? Is there technical limitation for a minimum size?

No, there's no real technical limitation. Except some hero should go through
src/jounal/journal-file.c and adjust all the constants that they also work
with very small files.

Zbyszek



Hi,

the minimum file size changed in version 203 from 64KiB to 4MiB. Is 
there a special reason for this? The relevant code line seems to be


#define JOURNAL_FILE_SIZE_MIN (4ULL*1024ULL*1024ULL)  /* 4 MiB */

which did not change in 208.

Sascha


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] journald API, sd_journal_seek_tail()

2013-12-04 Thread Sascha Kattelmann

Hi,

I'm working on Fedora 19 with systemd 204. I had trouble with the 
journald-API

regarding the seek_tail function. The bug is already described here:

https://bugs.freedesktop.org/show_bug.cgi?id=64614

Here is one more related post:

https://bugzilla.redhat.com/show_bug.cgi?id=979487

I guess this is no problem of Fedora. There seems to be a workaround in the
second link.

Whats the status of this bug?

- Sascha Kattelmann
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel