public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alan McKinnon <alan.mckinnon@gmail.com>
To: gentoo-user@lists.gentoo.org
Cc: Ralph Slooten <axllent@gmail.com>
Subject: Re: [gentoo-user] syslog-ng filtering
Date: Wed, 17 Mar 2010 12:39:47 +0200	[thread overview]
Message-ID: <201003171239.47431.alan.mckinnon@gmail.com> (raw)
In-Reply-To: <17bd4e851003161622x21b7e78chc228017250c7ff0f@mail.gmail.com>

On Wednesday 17 March 2010 01:22:59 Ralph Slooten wrote:
> Hi all,
> 
> Has anyone here worked out how to filter out syslog messages using
> syslog-ng v3? The old syntax doesn't work (well complains bitterly about
> performance and says to use regex), and no matter what I try I cannot get
> the new syntax to work :-/ I have a syslog-ng server which logs to MySQL
> for multiple clients in a network, however the database just keeps growing
> with irrelevant data I'd prefer to just quietly ignore on the server side.
> 
> I'm trying to filter out (exclude) messages such as:
>   (root) CMD (/root/bin/vmware-checker)
> and
>   (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )
> 
> ==============
> filter myfilter {
>         not match("regex" value("\/usr\/sbin\/run-crons"))
>         and not match("regex" value("vmware-checker"));
> }

Hah! this caught me out too.

The value of "value" cannot be anything arbitrary - syslog-ng has no clue what 
you mean. The value is a field name, either a pre-defined one, or something 
you defined using a parser. The docs are ambiguous on this, it's not clear 
that the supplied values are abstracts. You are truing to search for the 
string "regex" in a field called /usr/bin/vmware-checker.

Which obviously will not work.

I think you want:

match("\/usr\/sbin\/run-crons" value "MESSAGE")

Note that it is MESSAGE. You want the field name, not it's dereferenced value.



> log {
>         source(src);
>         source(remote);
>         filter(myfilter);
>         destination(d_mysql);
> };
> ===============
> 
> However they just keep coming through the filter (ie: not matching the "not
> match" filter). I've tried escaping the slashes, not escaping them ... even
> partial words, but I obviously am missing something somewhere.
> 
> Anyone have any ideas?
> 
> Thanks in advance,
> Ralph

-- 
alan dot mckinnon at gmail dot com



  parent reply	other threads:[~2010-03-17 10:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-16 23:22 [gentoo-user] syslog-ng filtering Ralph Slooten
2010-03-17  0:00 ` Roy Wright
2010-03-17  2:49   ` Ralph Slooten
2010-03-17 10:48     ` Fred Leon
2010-03-17 10:39 ` Alan McKinnon [this message]
2010-03-17 11:12   ` [gentoo-user] " Robert Fekete
2010-03-17 20:16   ` [gentoo-user] " Ralph Slooten
2010-03-17 20:31     ` Alan McKinnon
2010-03-19  7:56       ` [gentoo-user] " Robert Fekete
2010-03-17 20:40     ` [gentoo-user] " Keith Dart
2010-03-17 21:43       ` Ralph Slooten
2010-03-18  6:39         ` Alan McKinnon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201003171239.47431.alan.mckinnon@gmail.com \
    --to=alan.mckinnon@gmail.com \
    --cc=axllent@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox