summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2015-09-15Version 0.2.2HEADmasterJoern Engel1-1/+1
Signed-off-by: Joern Engel <joern@logfs.org>
2015-09-15ignore "eth0." dns prefixesJoern Engel1-4/+8
Some people use "eth0.machine.example.com" instead of "machine.example.com" as reverse dns names. Signed-off-by: Joern Engel <joern@logfs.org>
2015-09-15Close idle logfilesJoern Engel1-10/+28
We hit the maximum file limit. 75% of that seems to be from active machines, but we may also have stale ones that we needlessly keep open. It is fairly cheap to close them once an hour. Signed-off-by: Joern Engel <joern@logfs.org>
2015-09-15Fix size optionJoern Engel1-1/+1
Getopt parameter was forgotten. Silly. Signed-off-by: Joern Engel <joern@logfs.org>
2015-09-15Improve syslogJoern Engel1-1/+7
Only print a message when dns resolution changed - usually once when the machine logs for the first time. Also print a human-readable ip address. The hex number was pretty much unusable. Signed-off-by: Joern Engel <joern@logfs.org>
2015-09-08Bump version to 0.2.1Joern Engel2-5/+1
Signed-off-by: Joern Engel <joern@logfs.org>
2015-02-17Fix MakefileJoern Engel1-2/+2
clean target missed btree.o. And for some strange reason cancd fails to compile on an older ubuntu system unless ld gets "-Wl,--no-as-needed" passed in. Signed-off-by: Joern Engel <joern@logfs.org>
2015-02-17Cache open/stat for performanceJoern Engel1-15/+51
Open fd stays valid for 60s. It will actually stick around forever, there is no garbage collection for stale files yet. Signed-off-by: Joern Engel <joern@logfs.org>
2015-02-17Add a maximum file size parameterJoern Engel1-5/+24
Sometimes there are a few noisy machines generating 100GB+ per day, filling up the disk and preventing logrotate from cleaning things up. Manual intervention is required and several hours or days of logs are lost - depending on how timely the humans respond. Having a fixed limit of 1GB or some other reasonable value ensures we lose logs from the noisy machines, but not from the well-behaving ones due to full disk. Signed-off-by: Joern Engel <joern@logfs.org>
2012-11-20Fix 32bit btree primitivesJoern Engel2-6/+12
Using an unsigned long * to a u32 gives 32 random bits. Not a good identifier. Signed-off-by: Joern Engel <joern@logfs.org>
2012-11-20Create files with 0644, not 0600Joern Engel1-2/+2
Allows other user without write access to read logfiles. Signed-off-by: Joern Engel <joern@logfs.org>
2012-05-06Fix do_writeJoern Engel1-0/+1
After about four month, we never noticed this rather obvious bug. Tells you something about the frequency of short writes. Signed-off-by: Joern Engel <joern@logfs.org>
2012-05-04Syslog on dns resolverJoern Engel1-0/+1
When having to deal with b0rken reverse DNS and trying to figure out what machine happens to be called FOO by reverse DNS, while no machine FOO exists in forward DNS, a small amount of paper trail might be useful. The format isn't as nice as it could be. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-17Normalize and shorten filenamesv0.2.0Joern Engel1-1/+11
Turns TESTHOST07.bla.com into testhost07. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-17Update version to 0.2.0Joern Engel2-2/+2
Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-17Copy data from ip-file to name-fileJoern Engel1-4/+49
Also remove the "optimization" strcmp, as it was buggy. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-17Remove dirname() codeJoern Engel1-15/+1
We no longer allow complicated name structures, so this code has become pointless. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-17Create DNS threadJoern Engel2-4/+47
When possible we should use DNS hostnames instead of IP addresses as logfile names. But gethostbyaddr() can block indefinitely, so run that command from a dedicated thread. If it blocks, we just write to the ip address name. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-17Add per-ip cacheJoern Engel1-9/+37
Currently used for newlines and filename. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-17Remove ULONG_MAX definitionJoern Engel1-1/+0
Already defined in libc by now. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-16Add dependency on header Makefile and headersJoern Engel1-0/+2
Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-16Compile btree library inJoern Engel2-48/+2
Also remove AGGRESSIVE_COMPACTION, as we won't need it and silence a (wrong) compiler warning. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-16Add my btree libraryJoern Engel3-0/+1241
It will be used to store per-ip data, like reverse dns lookups, whether we previously had a newline, etc. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-16Hack around short writesJoern Engel1-6/+15
Actual netconsole packets can be shorter than a line. So instead of creating a new line plus timestamp for every fragment, remember whether we had a newline before and only add a timestamp in those cases. Currently this is still semi-broken. We have no memory across packets, so timestamps are never printed for the first line of a packet. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-16Prevent stray newlinesJoern Engel1-2/+7
Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-16Sanitize buffer sizeJoern Engel1-2/+6
There is no point in depending on page size or supporting machines where sizeof(char) is not one. Also warn if ever the buffer is too small, so people have an indication to go and increase it. And just in case 32k is not enough, bump the size to 1M. Memory is cheap enough these days. Signed-off-by: Joern Engel <joern@logfs.org>
2012-01-16Fix e0bbe426Joern Engel1-2/+4
Last commit clearly was untested. Don't commit on an airport, ever. - NUL-terminate string before handing it off to strchrnul(). - Fix off-by-one (NUL byte). - Fix spelling. Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-23Prepend date string to each lineJoern Engel1-2/+31
Make this look more like syslog. Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-22Factor out do_writeJoern Engel1-12/+17
A good candidate for a libc function, if ever there was one. Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-22make do_output() voidJoern Engel1-10/+5
It only ever returned 0 - making the return code fairly pointless. Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-22Simplify valid_format()Joern Engel1-5/+2
Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-22Simplify file formatJoern Engel1-35/+16
No more funny business with time/date. We expect a lot of output, not just the rare kernel panic. Having literally millions of files around simply doesn't fly. Also, I believe the old code failed to NUL-terminate the string. Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-22Remove af parameter from get_pathJoern Engel1-4/+4
If all callers use the same parameter, don't bother passing it. Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-18Fix relative path goofup and overflowsv0.1.0Joern Engel1-5/+1
The usage of strncat is a textbook case of when to use strlcat instead. The double strlen is just wasting performance, assuming no buffer overflows in strncat before. And lastly, the program already cd'd into the proper directory. So for a relative path "foo" we created files under "foo/foo/", not under "foo/". Quite a number of bugs to fix by removing so little code. Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-18Fix version numberJoern Engel1-1/+1
Tarball sais 0.1.0, so match that. Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-18Compile fix: add <limits.h>Joern Engel1-12/+13
And sort the includes, while at it. Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-18Lindent the sourceJoern Engel1-545/+435
Signed-off-by: Joern Engel <joern@logfs.org>
2011-12-18cancd 0.1.0 as found on oss.oracle.comJoern Engel5-0/+1141
Signed-off-by: Joern Engel <joern@logfs.org>