Commit Graph

349 Commits

Author SHA1 Message Date
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Ian Lepore
f0c7dfca42 Add ENETUNREACH and EADDRNOTAVAIL to the list of errors that are potentially
transient and shouldn't result in closing the socket and giving up forever.
2013-11-13 01:04:02 +00:00
Ian Lepore
6a3e86ff22 This fixes 3 problems in syslogd related to sizing receive buffers...
- A call was misplaced at the wrong level of nested if blocks, so that
  the buffers for unix domain sockets (/dev/log, /dev/klog) were never
  increased at all; they remained at a way-too-small default size of 4096.

- The function that was supposed to double the size of the buffer
  sometimes did nothing, and sometimes installed a wildly-wrong buffer
  size (either too large or too small) due to an unitialized 'slen'
  variable passed to getsockopt().  Most often it doubled the UDP buffers
  from 40k to 80k because accidentally there would be harmless stack
  garbage in the unitialized variables.

- The whole concept of blindly doubling a socket's buffer size without
  knowing what size it started at is a design flaw that has to be called a
  bug.  If the double_rbuf() function had worked at all (I.E., if the
  other two bugs didn't exist) this would lead to UDP sockets having an
  80k buffer while unix dgram sockets get an 8k buffer.  There's nothing
  about the problem being solved that requires larger buffers for UDP than
  for unix dgram sockets -- the buffering requirements are the same
  regardless of socket type.

This change renames the double_rbuf() function to increase_rbuf() and
increases the buffer size on all types of sockets to 80k.  80k was
chosen only because it appears to be the size the original change was
shooting for, and it certainly seems to be reasonably large (I might
have picked 64k in the absence of any historical guidance).

PR:		160433
Submitted by:	me, in 2011.
2013-11-13 01:01:15 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Jilles Tjoelker
f35bb1a01e syslogd: Use closefrom() instead of getdtablesize()/close() loop.
When syslogd forks a process for '|' destinations, it closes all file
descriptors greater than 2.

Use closefrom() for this instead of a getdtablesize()/close() loop because
it is both faster and avoids leaving file descriptors open because the limit
was lowered after they were opened.

MFC after:	1 week
2013-04-27 13:26:35 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Mark Johnston
f26612d3ac - Make sure that errno isn't modified before calling logerror() in error
conditions.
- Don't check for AF_INET6 when compiled without INET6 support.

PR:		bin/173930
Submitted by:	Garrett Cooper <yanegomi@gmail.com>
Approved by:	rstone (co-mentor)
MFC after:	1 week
2012-12-20 23:21:20 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Ed Schouten
39893d565a Add missing const keywords. 2012-10-19 14:29:03 +00:00
Eitan Adler
b5bec59148 Add documentation for IPv6 support
PR:		docs/171580
Submitted by:	bdrewery
Reviewed by:	wblock
Approved by:	gjb
MFC after:	1 month
X-MFC-With:	r240389
2012-09-12 16:58:42 +00:00
Baptiste Daroussin
2c0a5e3cee Add support for ipv6 addresses as destination
PR:		bin/150530
Submitted by:	andy white <andywhite@gmail.com>
Tested by:	Olivier Cochard-Labbe <olivier@cochard.me>
MFC after:	1 month
2012-09-12 10:39:47 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Joel Dahl
8972c8b6a5 Minor spelling fixes. 2012-06-03 11:29:48 +00:00
Sean Bruno
815a08056d Update man page to present -T argument in synopsis
MFC with r183347

MFC after:	0 days
2012-03-14 21:26:06 +00:00
Xin LI
35741267c0 Add a new option, -N to disable the default and recommended syslogd(8)
behavior, which binds to the well known UDP port.

This option implies -s.

MFC after:	2 months
2011-07-14 07:33:53 +00:00
David Malone
98d1f19ba2 Here v->iov_len has been assigned the return value from snprintf.
Checking if it is > 0 doesn't make sense, because snprintf returns
how much space is needed if the buffer is too small. Instead, check
if the return value was greater than the buffer size, and truncate
the message if it was too long.

It isn't clear if snprintf can return a negative value in the case
of an error - I don't believe it can. If it can, then testing
v->iov_len won't help 'cos it is a size_t, not an ssize_t.

Also, as clang points out, we must always increment v here, because
later code depends on the message being in iov[5].
2011-01-19 17:17:37 +00:00
Warner Losh
467a4a2748 This isn't WARNS=6 safe. It fails to build on mips. Retore old
WARNS?=3 until that's resolved.
2010-08-08 02:45:14 +00:00
Oliver Fromme
2c76b63f00 jh pointed out that src/usr.sbin already has a global
WARNS=6 setting in HEAD (unlike stable/8), so it's best
to remove the line entirely.

Pointed out by:	jh
Approved by:	des (mentor)
2010-08-07 20:46:30 +00:00
Oliver Fromme
974835c956 syslogd(8) already supports *sending* log messages to non-
standard ports, but it can't *receive* them (port 514 is
hardcoded).  This commit adds that missing feature.

(NB:  I actually needed this feature for a server farm where
multiple jails run with shared IP addresses, and every jail
should have its own syslogd process.)

As a side effect, syslogd now compiles with WARNS=6.

Approved by:	des (mentor)
MFC after:	3 weeks
2010-08-07 16:20:12 +00:00
Ed Schouten
b5810e9449 Port all applications in usr.sbin/ from libulog to utmpx. 2010-01-13 18:17:53 +00:00
Ed Schouten
2734cf8c82 Let syslogd use utmpx.
Because strings are guaranteed to be null terminated, there is no need
for excessive copying of strings, such as the line name.
2009-12-24 18:05:33 +00:00
Attilio Rao
7a7043c787 Avoid sshd, cron, syslogd and inetd to be killed under high-pressure swap
environments.
Please note that this can't be done while such processes run in jails.

Note: in future it would be interesting to find a way to do that
selectively for any desired proccess (choosen by user himself), probabilly
via a ptrace interface or whatever.

Obtained from:	Sandvine Incorporated
Reviewed by:	emaste, arch@
Sponsored by:	Sandvine Incorporated
MFC:		1 month
2009-11-25 15:12:24 +00:00
Andriy Gapon
5cd1d3ff17 syslog.conf(5): correct example
security.* and console.* are moved out of ftpd program block

Approved by:	jhb (mentor)
MFC after:	2 weeks
2009-06-11 18:42:31 +00:00
Tom Rhodes
5b34e7083c Add "crit" to the list of keywords.
PR:		126934
2008-12-23 17:39:24 +00:00
Xin LI
7ad0654cff Constify 'name' field in struct funix. This commit makes syslogd(8)
WARNS?=6 on amd64 but I have not tested under universe so keep WARNS?=
level as-is for now.
2008-12-19 18:27:51 +00:00
Tai-hwa Liang
2db461e489 Fixing !INET6 builds after bumping WARNS to 3. 2008-12-18 04:03:29 +00:00
David E. O'Brien
58a841efc2 Use passed parameter rather than the #define.
(more accurate extraction of Juniper Networks change)
2008-12-17 16:55:58 +00:00
David E. O'Brien
97f37b322d Rather than hardcode the 'struct iovec iov' array size, use a #define.
While I'm here bump WARNS to 3.

Obtained from:	Juniper Networks
2008-12-17 16:51:40 +00:00
Tom Rhodes
efe78a46f7 Use "allowed_peer" throughout this manual page. 2008-12-07 18:45:30 +00:00
David Malone
cfcf794e5f Add a flag, -T, that tells syslogd to always replace the timestamp on
messages from the network. We already replace malformatted timestamps
and this option lets us replace timestamps that are correctly formatted
but wrong.

PR:		120891
Submitted by:	Thomas Vogt <thomas@bsdunix.ch>
MFC after:	1 week
2008-09-25 09:28:18 +00:00
David E. O'Brien
16d2cd9432 Remove extraneous NULL pointer check - the pointer is guaranteed to be non-NULL. 2008-09-01 15:10:03 +00:00
Maxim Sobolev
7e1535c571 Allow comment to be placed at the end of a configuration line.
MFC after:	2 weeks
2008-07-09 07:37:54 +00:00
Brian Somers
d7022add17 Add a -8 switch to syslogd to prevent it from mangling 8-bit data. 2008-05-14 00:22:21 +00:00
David Malone
6f540420dd Two no-op fixes to improve corretness of syslogd code:
1) Use [AP]F_LOCAL rather than [AP]F_UNIX.
2) When copying a pipe's name, use f->f_un.f_pipe.f_pname, not f->f_un.f_fname.

PR:		20889
Submitted by:	Damieon Stark
PR:		116642
Submitted by:	Jim Pirzyk
Reviewed by:	md5
2008-02-20 21:54:41 +00:00
David E. O'Brien
e7ec0d579b + Open ctty in non-blocking mode to avoid hangs during open and close(waiting
for the port to drain).
+ Handle "*" as a priority properly.
+ Test what is free'ed.
+ Dynamically determine length vs. hardcoding it.
+ Free the previous message buffer (f_prevline) only after logging all the
  messages and just before the process exit.  Also check f_prevline for NULL
  before using it.
+ The time displayed is not synchornized with the other log destinations.
+ Fix a comment.

Obtained from:	Juniper Networks
2007-12-11 06:10:10 +00:00
David E. O'Brien
817a9ffcc4 style(9) 2007-12-05 18:00:41 +00:00
Tom Rhodes
42c3aae2ea Mark up keywords with .Cm.
PR:		95039
Sumitted by:	SeaD (older version)
Reviewed by:	ru
2006-10-12 01:59:34 +00:00
Ruslan Ermilov
bc84aa4ba3 Markup fixes. 2006-09-29 17:57:04 +00:00
Ruslan Ermilov
b3e2f7a6d8 Sync usage() with manpage's SYNOPSIS. 2006-09-29 17:36:38 +00:00
Yaroslav Tykhiy
6884810944 Obey MK_INET6_SUPPORT. 2006-07-27 14:52:12 +00:00
Julian Elischer
be389c75f0 Add the ability to log to an arbitrary udp port as well as the
standard syslog port. This allows syslog to easily export lines of interest to
an external logging system.
2006-04-17 20:12:35 +00:00
Christian S.J. Peron
ae4f0fc3a9 Currently, if writing out a log entry fails, we unlink that log entry from our
internal list of logfiles. So if writev(2) fails for potentially transient
errors like ENOSPC, syslogd requires a restart, even if the filesystem has
purged.

This change allows syslogd to ignore ENOSPC space errors, so that when the
filesystem is cleaned up, syslogd will automatically start logging again
without requiring the reset. This makes syslogd(8) a bit more reliable.

MFC after:	1 week
2006-03-30 21:04:52 +00:00
Pawel Jakub Dawidek
c503ddf2cc By default (for security reasons) syslogd(8) doesn't create log files
when they don't exist, but sometimes its quite useful (eg. we use
non-standard log files and memory backed /var/, which is populated on
boot).

Add -C option which tells syslogd(8) to create log files if they don't
exist.

Glanced at by:	phk
MFC after:	3 days
2006-03-06 10:36:33 +00:00
Julian Elischer
f47dba63bb Fix typo 2006-02-23 18:51:02 +00:00
Warner Losh
327608b266 style(9) nitlet:
foo() {
}

to

foo()
{
}
2005-10-17 16:51:06 +00:00
Olivier Houchard
c825862e6c setsockopt() will return -1 on error, not 0.
Pointy hat to:	Jeremie Le Hen
2005-09-28 16:14:43 +00:00
Olivier Houchard
20c0b2d3c3 Use SO_REUSEADDR on the socket, to make the use of syslogd in jails easier.
Submitted by:   Jeremie Le Hen <jeremie le-hen org>
2005-09-28 16:05:13 +00:00
Pawel Jakub Dawidek
fa39391686 Use pidfile(3) in syslogd(8). 2005-08-24 17:26:26 +00:00
Giorgos Keramidas
6fb9b618f5 Fix all the spelling mistakes I could find in the man pages for words
that have at least 3 characters.

MFC after:	1 week
Thanks to:	Music band ``Chingon''
		for keeping me company while searching for these.
2005-07-31 03:30:48 +00:00
Christian S.J. Peron
8e56d2ee05 Add cases for ENOBUFS and ENETDOWN. We need to make sure that we
catch all transient errors. This fixes situations where transient
error conditions such as network interfaces losing carrier signals
or the system running out of mbufs would result in the permanent
removal of forwarding syslog messages.

MFC after:	1 week
2005-05-19 21:09:44 +00:00
Hajimu UMEMOTO
4f10131848 NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.
2005-05-13 16:31:11 +00:00
Hiroki Sato
15f3d79b55 Add -S option which allows to change the pathname of the privileged
socket /var/run/logpriv.

Reviewed by:	glebius and kensmith
MFC after:	2 days
2005-04-13 03:19:41 +00:00
Gleb Smirnoff
b4e852907f Check that supplied facility is not bigger than LOG_NFACILITIES.
PR:		bin/79260
Submitted by:	Shuichi KITAGUCHI
2005-03-28 10:59:19 +00:00
Ruslan Ermilov
36a142c455 Expand contractions. 2005-02-13 23:45:54 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
59a3c79da6 Sort sections. 2005-01-18 20:02:45 +00:00
Ruslan Ermilov
1a74e6a157 Scheduled mdoc(7) sweep. 2005-01-11 11:47:22 +00:00
David Malone
f56bb70ae6 Allow ':' and '%' in hostname specifications so that we can specify IPv6
addresses and scope IDs.

MFC after:	3 weeks
2004-12-28 22:25:04 +00:00
David Malone
62f29f306a Some syslog messages delimit the program tag with whitespace rather
than a colon, so don't allow whitespace in program names. To be
consistent with hostnames, don't allow whitespace in the program
name specifiers in syslog.conf either.

(The first change is by Markus from the PR, the second is mine.)

PR:		68691
Submitted by:	Markus Oestreicher <m.oe@x-trader.de>
MFC after:	3 weeks
2004-12-28 21:58:54 +00:00
Gleb Smirnoff
204d318009 s/priveleged/privileged/ 2004-11-18 13:37:33 +00:00
Giorgos Keramidas
d6c85264cd Fix a minor comment typo: priveleged = privileged. 2004-11-18 12:20:52 +00:00
Ruslan Ermilov
a7c23514f6 Really revert the whitespace change to usage(). 2004-11-11 18:09:00 +00:00
Gleb Smirnoff
24f3d18aa1 Change TABs back to spaces in usage string constants.
Requested by:	ru
2004-11-11 16:13:10 +00:00
Gleb Smirnoff
033b92f386 Whitespace.
Approved by:	cvs diff -b
2004-11-11 09:41:03 +00:00
Gleb Smirnoff
43af2cc4a5 Double receive buffer size on sockets.
PR:		bin/72366
Ok'd by:	dwmalone
Approved by:	julian (mentor)
Obtained from:	OpenBSD
MFC after:	1 month
2004-11-11 09:39:04 +00:00
Ken Smith
de655741ce Bump document date.
Noticed by:     trhodes
Pointy hat:     kensmith
MFC after:      1 week
2004-11-09 04:41:12 +00:00
Ken Smith
83d71f6175 Add newsyslog(8) to the "See Also" section.
MFC after:	1 week
2004-11-09 04:31:31 +00:00
Gleb Smirnoff
240d5a9b1c Protect against local flooder of /var/run/log. Do not loop forever in
syslog(3) if we are a priveleged program (sshd, su, etc.).

- Make syslogd open an additional socket /var/run/logpriv, with 0600
  permissions.
- In libc, try to use this socket.
- Do not loop forever if we are using this socket (partial backout of 1.31)

Reviewed by:	dwmalone, Andrea Campi <andrea webcom it>
Approved by:	julian (mentor)
MFC after:	1 month
2004-11-04 23:09:57 +00:00
Gleb Smirnoff
247444670e - Use stailqueue for sockets instead of socket buffer. Thus
remove limit for 20 sockets.
- Add possibility to specify file mode for sockets created with '-l'.
- Check that socket name in '-l' is absolute.

Reviewed by:	dwmalone, Andrea Campi <andrea webcom it>
Approved by:	julian (mentor)
2004-11-04 22:20:21 +00:00
Warner Losh
486c8cc4c6 Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived software
(with permission of addtional copyright holders where appropriate)
2004-08-07 04:28:56 +00:00
Colin Percival
decbf84ef3 Fix dofsync() declaration.
Pointed out by:	dwmalone
2004-07-04 19:52:48 +00:00
Colin Percival
e1906bda7b Where syslogd would have fsync()ed a file in the past, instead set a flag
FFLAG_NEEDSYNC and fsync the file when select() next returns zero.  This
dramatically speeds up the process of logging large amounts of data, while
leaving the essential semantics (that data can be expected to be on disk
if we crash) unchanged.

In my tests, this speeds up the rc phase of booting by 18-20%. [1]

YES PLEASE! by:	phk [1]
2004-07-04 19:13:58 +00:00
Ruslan Ermilov
455fb174df Eliminated double whitespace. 2004-07-03 18:35:53 +00:00
Ruslan Ermilov
07bfccd71e Mechanically kill hard sentence breaks. 2004-07-02 23:13:00 +00:00
David Malone
2b1071b296 Also terminate program names if we hit a '/' - this is to be slightly
more friendly to postfix log messages.

PR:		50912
Submitted by:	Stanislav Lapshansky <slapsh@slapsh.pp.ru>
2004-05-30 10:34:58 +00:00
David Malone
0f2ffc4e31 A log file name may now be prefixed by a '-' if it should not be
explicitly fsynced after kernel messages are logged. This option
should be syntax compatible with a similar option in Linux syslogd.

I've made some small changes to Pekka's patch, hoepfully I haven't
goofed anything.

PR:		66790
Submitted by:	Pekka Savola <pekkas@netcore.fi>
Obtained from:	Martin Schulze's syslogd
MFC after:	1 month
2004-05-30 10:04:03 +00:00
David Malone
3b7e120185 Try to be more careful about using using the file descriptor f_file.
Syslogd should ensure that f_file is a valid file descriptor when
f_type is FILE, CONSOLE, TTY and for a PIPE where f_pid > 0. If the
descriptor is closed/invalid then the type should be set to UNUSED
or the pid should be set to 0.

To this end:
1) Don't close(f->f_file) if we can't send a message to a remote
   host because the file descriptor used for remote logging is
   stored in finet, not in f->f_file. f->f_file is probably
   uninitialised, so I guess we usually end up closing fd 0.
2) Don't close PIPE file descriptors if they are invalid.
3) If the call to p_open fails, don't set the pid.

The OpenBSD patches in this area set f_file to -1 after the fd is
closed and then avoids calling close if f_file < 0. I haven't done
this, but it might be a good idea too.

Inspired by:	PR 67139/OpenBSD
2004-05-30 00:02:19 +00:00
David Malone
75030d0676 Some string fixes.
1) Use strncpy on strings out of utmp.
2) Avoid running off the start of one string while removing white space.
   (I've used slightly different code to OpenBSD here.)
3) Ignore trailing spaces in the priority.

PR:		67139
Submitted by:	Xin LI <delphij@FreeBSD.org.cn>
Obtained from:	OpenBSD
2004-05-29 23:40:30 +00:00
David Malone
6f8c264082 Exit with a warning if the path to one of the logging sockets is
too long, rather than silently truncating them.

PR:		67139
Inspired by:	OpenBSD
2004-05-29 23:27:50 +00:00
David Malone
ac3a1548f8 Fix some bugs that don't manifest themselves in practice.
1) Don't check for getopt returning '?', we have a default case.
2) Check if the priority is LOG_KERN correctly - in practice
   LOG_KERN is 0, so it makes no difference. OpenBSD fixed a
   different nearby bug that we don't have 'cos our definition
   of LOG_MAKEPRI is different to OpenBSD's.

Copy a comment from OpenBSD, observing that LOG_KERN is 0.

Inspired by PR:		67139
2004-05-29 23:24:18 +00:00
David Malone
a944213190 Update a couple of comments.
PR:		67139
Submitted by:	Xin LI <[3]delphij@FreeBSD.org.cn>
Obtained from:	OpenBSD
2004-05-29 23:14:03 +00:00
David Malone
ef4dd325c4 Silence some constness and printf type warnings. Most of the
const fixes are ugly 'cos the types in an iovec aren't quite
right for a writev.
2004-05-26 21:14:13 +00:00
Ruslan Ermilov
47d7e8a96f Fixed style of DPADD and LDADD assignments as per style.Makefile(5). 2004-02-05 22:44:25 +00:00
Ian Dowse
9323dbdb0a Use strtol to parse the <%d> tags in printline() and printsys().
Sort local variables declarations in these functions.

Submitted by:	bde
2004-01-31 17:44:27 +00:00
Ian Dowse
ff96c77dc4 Be much more strict about parsing tagged log messages from /dev/klog;
if the line doesn't match ^<%d>, then treat it as a regular kernel
printf line. Previously if a kernel printf message started with "<"
it would be interpreted as a log message, often with LOG_EMERG
level. This was triggered by some printfs in sys/dev/aic7xxx/, and
can also happen with the partial lines that result if syslogd cannot
keep up with the rate of arrival of kernel messages.

Reviewed by:	dwmalone
MFC after:	1 week
2004-01-26 00:46:46 +00:00
David Malone
de4aac0deb logerror is used in syslogd to log errors from syslogd itself. It
is possible for an error to occur while trying to log an error, and
this can result in infinite recursion (or at least until we run out
of stack).

Rather than this, we ignore requests to log an error while logging an
error.

PR:		51253
MFC after:	2 weeks
2003-11-16 21:51:06 +00:00
David Malone
3c453e20f9 Remove an argument to printf that is unused. 2003-11-16 21:42:00 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Gregory Neil Shapiro
cc22785824 Avoid a corrupt timestamp on the console
PR:		51587
Submitted by:	Dmitry Sivachenko <mitya@cavia.pp.ru>
Approved by:	re (rwatson)
MFC after:	3 days
2003-05-17 20:07:54 +00:00
Gregory Neil Shapiro
a22139f98d Avoid code duplication by using libutil's trimdomain() instead of
an incorrect re-implementation.

PR:		52223, 52342
Submitted by:	Dan Nelson <dnelson@allantgroup.com>
Approved by:	re (bmah/rwatson)
MFC after:	2 days
2003-05-17 20:05:18 +00:00
Gregory Neil Shapiro
4095c651b0 Cleanup hostname matching in syslogd:
1. Hostnames were not treated case insensitively in all cases.

2. The method for stripping hostnames when reading the syslog.conf
   differed from that when finding the hostname of an incoming request.
   This lead to a broken match check.  In my case, it meant I had to
   have '@scooter.smi.example.com.example.com' to have 'logger.example.com'
   properly save messages from 'scooter.smi.sendmail.com'.

3. Add paranoia to cfline() such that it doesn't try to access memory
   outside of the bounds of the f_host string.

4. While I am here, get rid of an outdated comment, argv[{0,1,2}] are now
   checked for NULL after the strdup() calls.

Reviewed by:	dwmalone
MFC after:	1 week
2003-05-04 22:05:40 +00:00
David E. O'Brien
052238b16c style.Makefile(5) 2003-04-04 17:49:21 +00:00
Thomas Quinot
f3a9f7841a Hostname specifications must allow commas in the value. They are
used to separate multiple host names.

Noted by:	Dan Nelson <dnelson@allantgroup.com>
Reviewed by:	roberto
2003-02-21 19:02:31 +00:00
Thomas Quinot
7ac1f02eed Allow multiple hosts or programs to be named in program
or host specifications, eg:

!foo,bar
*.* /var/log/only_foo_or_bar.log

!-foo,bar
*.* /var/log/all_except_foo_or_bar.log

Reviewed by:		roberto
Not objected to by:	arch@
2003-02-13 00:08:56 +00:00
Tom Rhodes
6b010ec682 Various language tweaks.
PR:		45604
Submitted by:	Chris Pepper <pepper@rockefeller.edu>
2002-12-24 01:04:42 +00:00
Ruslan Ermilov
8d5d039f80 Uniformly refer to a file system as "file system".
Approved by:	re
2002-12-12 17:26:04 +00:00
Ruslan Ermilov
c041c1e0d9 mdoc(7) police: markup fixes.
Approved by:	re
2002-11-27 15:31:08 +00:00
Thomas Quinot
6888370488 Factor out the code that determines whether a message must be skipped
as a consequence of a host or program name specification into a common
function, skip_pmessage.

Reviewed by:	roberto
2002-11-07 19:53:29 +00:00
Garrett Wollman
cd9a4d5d7a Add used #include <limits.h>. 2002-10-27 17:46:53 +00:00
Tim J. Robbins
50a4cf33ca Sync usage() with reality and sort it alphabetically.
PR:		42620
Submitted by:	Jeff Ito
MFC after:	1 month
2002-10-18 11:48:46 +00:00
Tim J. Robbins
7c5bf58a15 Add -c option to synopsis. Sort it alphabetically, too. 2002-10-18 11:42:21 +00:00
Dag-Erling Smørgrav
695df15da2 Avoid referencing a removed (and freed) queue entry. This partially reverts
revision 1.101 (which did not introduce the bug but made it harder to fix)

PR:		misc/40363
Submitted by:	David Dunham <dwdunham@isilon.com>
MFC after:	2 weeks
2002-10-06 17:43:04 +00:00
Daniel C. Sobral
f50b861cbf Introduce to the !program specification a capability similar to the one
that already exists for hosts: being able to specify a section that applies
to every program *except* the one in question.

The normal syntax for program specification is still valid. For the new
capability, one uses:

!-program

Since there is no way to specify a program beginning with a dash in the old
syntax, as it would be interpreted as the case above, the following
alternative syntax to the original capability is provided:

!+program

This shouldn't introduce incompatibilities with any syslogd configuration
in production because -stable's syslogd does not support a dash anywhere in
the program specification.

MFC after:	2 weeks
2002-09-23 11:59:19 +00:00
David Malone
ef21d92fcf Make syslogd -u treat "*" as all levels by explictly setting pri_cmp
for it.

While I'm here, add a the ability to say "!level" in a way which
should be compatible with Linux's syslogd.

PR:		28935
No objections:	audit
MFC after:	2 weeks
2002-09-04 21:11:25 +00:00
Crist J. Clark
fcfce9770f Don't give up on a remote log host when we get a EHOSTUNREACH or
EHOSTDOWN. These are often transient errors (when the remote host
reboots, temporary network problems, etc.), and we'd rather err on the
side of caution and keep trying send messages that never arrive than
just give up.

Note that this is not an implementation of the "back-off" methods
given in the PR. Those just seem too complicated. Why not just keep
trying each time? Trying and failing doesn't really consume
significantly more resources than if we were successful for each
message.

PR:		bin/31029
MFC after:	1 week
2002-08-25 06:05:25 +00:00
Robert Drehmel
7c33f2d1e6 When parsing the program name from the incoming log message
from a client, accept all printable characters as being part
of the program name, except ':' and '[', because each is a
possible delimiter.
2002-07-25 15:45:41 +00:00
Robert Drehmel
52384d0388 When reading a program name from the syslog configuration file,
do not stop copying it into a buffer when encountering a
non-alphanumerical character.  Only stop at unprintable characters.
This makes syslogd work correctly with executables like `interp.bin',
`httpd_old', etc.

PR:		misc/40941
MFC after:	1 week
2002-07-25 09:56:37 +00:00
Hajimu UMEMOTO
fc99a00c7f use IPV6_V6ONLY instead of non standard IPV6_BINDV6ONLY.
MFC after:	1 week
2002-07-22 15:22:53 +00:00
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +00:00
Tom Rhodes
67c8020f12 Consistancy check: s/file system/filesystem/g 2002-05-16 02:28:39 +00:00
Dag-Erling Smørgrav
083500e436 Remove spaces between (void) and function calls. Use TAILQ_FOREACH
instead of hand-rolled equivalent.  Add curly braces for symmetry
around else.
2002-03-24 06:02:10 +00:00
Dag-Erling Smørgrav
91f3557e12 Parenthesize return values and pull an orphaned { back into the fold. 2002-03-24 05:52:04 +00:00
Dag-Erling Smørgrav
32b027945c __FBSDID, ANSIfy function definitions, staticize functions and globals,
don't initialize globals to 0, some reindentation of declarations, some
comments added or reworded.
2002-03-24 05:48:37 +00:00
Dag-Erling Smørgrav
840f7e95d2 Un-__P(). 2002-03-24 05:24:04 +00:00
Maxim Konovalov
e1178b3b9d Remove unnecessary setjmp.h.
Reviewed by:	ru
Approved by:	ru
Obtained from:	OpenBSD
MFC after:	1 week
2002-02-13 08:49:29 +00:00
Maxim Konovalov
191c304372 Unlink all log sockets at startup.
PR:		misc/34839
Reviewed by:	ru
Approved by:	ru
Obtained from:	OpenBSD
MFC after:	2 weeks
2002-02-13 08:37:55 +00:00
Ruslan Ermilov
8c9d547186 mdoc(7) police: add missing markup bit. 2002-01-10 15:16:58 +00:00
Daniel Eischen
8da986febb Initialze a stack variable with NULL to unbreak buildworld with -Wall.
I don't know about anyone else, but the compiler was always aborting
on this stupid warning, and has been doing so for weeks.
2002-01-09 17:36:53 +00:00
Archie Cobbs
3a0ac99551 Add a new flag '-c' to disable repeated line compression when the output
is a pipe to another program, or, if specified twice, in all cases.

PR:	bin/32420
2002-01-05 07:34:52 +00:00
Ruslan Ermilov
d3f58d4008 mdoc(7) police: markup nits. 2001-12-08 16:17:49 +00:00
Dima Dorfman
a53dffb774 Make the default kernel prefix "kernel:" instead of the boot file,
with the old behavior available via the -o option (it might still be
useful if one has many kernels and cares which messages came from
which).  If the boot file is not used as the prefix, it is still
logged once at startup.

This change is prompted by the fact that the boot file is now much
longer ("/boot/kernel/kernel" vs. "/kernel"), which significanlty
bloats the syslogd output.

Reviewed by:	peter
2001-11-27 20:02:18 +00:00
Paul Saab
4741693c8e If the mask length is zero, there is no need to convert it to a
netmask.

PR:		31947
Submitted by:	Aaron Scarisbrick <aaronsca@hotmail.com>
MFC after:	1 week
2001-11-14 09:20:24 +00:00
Dag-Erling Smørgrav
46ae3bbfea Check the return values from calls to malloc(), calloc(), strdup() etc.
Submitted by:	Philippe Charnier <charnier@xp11.frmug.org>
MFC after:	2 weeks
2001-09-30 16:09:17 +00:00
Dag-Erling Smørgrav
f28f539f3c Add a strcasecmp() call I forgot in my hurry to commit the previous fix.
Without this call, the hostname check would in some cases yield false
positives.

Pointed out by:	ru
2001-09-13 09:40:35 +00:00
Dag-Erling Smørgrav
db87d61acf The previous commit appeared to just shove the bug under the carpet rather
than really solve it.  This approach (inspired by Ruslan's patch) solves
the real problem by stripping the local domain off the host name in the
config line structure.

Also mark a bunch of code sections that either do not check the return value
of a strdup(), malloc() or calloc() call, or do not properly handle a NULL
return.
2001-09-13 06:48:41 +00:00
Dag-Erling Smørgrav
a5cc8abe03 Fix logging from remote hosts, which has been broken since (at least) revision
1.64, i.e. July of last year.  Also fix a minor style bug in the same code.

PR:		bin/28634
Pointy hat to:	dwmalone
Pointed out by:	my buggy DSL router's remote logging facility
2001-09-13 05:09:14 +00:00
Ruslan Ermilov
7e848a7014 Fixed the free(3) panic overlooked due to the -Wno-uninitialized. 2001-09-11 08:18:04 +00:00
Dima Dorfman
df755a4837 Use CFLAGS instead of COPTS. 2001-09-09 14:30:36 +00:00
Dima Dorfman
d3ca0b131b - Silence warnings: apply `const' generously, mark some variables
__unused, and change local variables named `sin' (struct
  sockaddr_in) to `sin4'.  (`sin' conflicts with the definition of
  sin(3), which gcc assumes to be defined even if math.h isn't
  included (it's a builtin).  This is probably a bug in gcc.)

- Apply WARNS=1.  WARNS=2 was not used because this program assigns
  string literals to (struct iovec).iov_base for writing, and the only
  clean way to silence -Wwrite-strings in that case would be to
  strdup() and consequently free() those literals, which I considered
  too disruptive.

Reviewed by:	bde (partially)
2001-09-09 14:25:02 +00:00
Kris Kennaway
7e2f1d04d8 Correct a last minute sizeof() bogon in my previous commit. 2001-09-05 05:20:31 +00:00
Dima Dorfman
f676ae2b46 Introduce a -b option that allows the user to specify which address to
bind to.  This is useful for hosts running jails that need syslog to
maintain an open socket to log to a remote host.

Reviewed by:	sheldonh
2001-09-01 08:42:49 +00:00
Kris Kennaway
dc2bdcbddf Fix some unsafe signal handlers, and be careful not to overflow on fd_set.
Fix some string buffer operations.

Based on:	OpenBSD
Reviewed by:	audit
MFC after:	2 weeks
2001-09-01 07:57:35 +00:00
Crist J. Clark
7ae71655e7 Fix some small errors and markup nits.
Approved by:	ru
MFC after:	2 days
2001-08-28 19:10:51 +00:00
Crist J. Clark
ba1cc9067d Gives syslogd(8) the ability to refresh its idea of the hostname of
the system on which it is running. The hostname is reloaded when
'HUPped' and a log message generated to note a change (before anyone
points it out, this is not an added security feature).

PR:		bin/24444
Reviewed by:	freebsd-audit
Approved by:	ru
MFC after:	2 weeks
2001-08-27 21:37:15 +00:00
Dima Dorfman
9e5726611c Don't make it sound like -A is turning on the default behavior. 2001-08-27 11:04:09 +00:00
Brian Somers
36c1612b5e Handle snprintf() returning -1.
MFC after:	2 weeks
2001-08-20 13:24:39 +00:00
Ruslan Ermilov
94ba280c59 mdoc(7) police: join split punctuation to macro calls. 2001-08-10 17:35:21 +00:00
David E. O'Brien
90e655ea4e Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.
2001-07-20 06:20:32 +00:00
David E. O'Brien
ac24b049cc Remove GCC'isms in CFLAGS. 2001-07-20 04:23:13 +00:00
Hajimu UMEMOTO
74fd29e0bc - `-a' option for IPv6 was not working correctly.
- Lose any stray host bits that a user may have entered when providing
  a network number and netmask to the `-a' option for IPv6.  This is
  corresponding to 1.79 that is for IPv4 only.

MFC after:	1 week
2001-07-19 22:04:09 +00:00
Mike Barcroft
e3608b7813 Document the fact that syslogd(8) requires logs files to be created
before it will start logging to them.

PR:		27088
Approved by:	des
MFC after:	10 days
2001-07-18 13:31:08 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov
a4c37c816b mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 15:12:08 +00:00
Dima Dorfman
70d51341bf mdoc(7) police: remove extraneous .Pp before and/or after .Sh. 2001-07-09 09:54:33 +00:00
Crist J. Clark
6ca048f825 Lose any stray host bits that a user may have entered when providing
a network number and netmask to the '-a' option.

Approved by:	ru
MFC after:	1 week
2001-07-02 15:26:47 +00:00
Ruslan Ermilov
be5c8032a0 Note that -a is ignored if -s is also specified. 2001-06-06 12:48:22 +00:00
David Malone
38f612a1e6 Fix constness warning introduced in syslog.h 1.21. 2001-05-21 22:13:55 +00:00
Ruslan Ermilov
8fcaaa2e12 mdoc(7) police: uppercase abbreviations in revision 1.34. 2001-05-16 09:43:48 +00:00