LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-26-2014, 06:49 AM   #1
Jacob9767
LQ Newbie
 
Registered: Sep 2014
Posts: 3

Rep: Reputation: Disabled
Question Syslog-ng filter message question


We have incoming logs from two edge firewalls, we want to filter individual lines of logs... with the following within our syslog-ng.conf

##logging
filter f_sendpage {
message("%ASA-5-722033") or message("%ASA-6-722022"); };

from there the captured logs should be sent to a perl script which emails it to joeblogs@google.com for example..

##logging
destination d_sendpage { program ("/usr/local/bin/sendmessage.pl"); };

Now unfortunately, this is not picking up the ASA id number. but it can pick up any other word within the line.

This is what the start of a line would look like:

Sep 26 00:04:44 10.200.101.253 %ASA-5-722033: Deny udp src INSIDE

Am I doing something wrong?

Let me know,

Thanks.
 
Old 09-26-2014, 11:29 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
Is the % a special character? What if you just remove it?
 
Old 09-27-2014, 06:52 AM   #3
balabit
syslog-ng documentation maintainer at BalaBit
 
Registered: Jun 2009
Posts: 16

Rep: Reputation: 2
Hi,

are you sure that the %ASA... part is parsed into the MESSAGE field? If the message is not 100% in syslog format, it might happen that syslog-ng interprets it as a program name. You can check it if you create a template and write a few such messages into a file with the selected fields.

BTW, newer syslog-ng versions have a built-in SMTP destination, so you mught not have to use a separate script.

Regards,

Robert
 
Old 09-27-2014, 08:04 PM   #4
Jacob9767
LQ Newbie
 
Registered: Sep 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
I'm not entirely sure if it is getting parsed, but it should do as it should read all incoming messages and send it to the perl mailer script just like it creates a .log file and stores it all within there. So there's two destinations but that would not cause an issue...

I've looked at swatch as a alternative and it works as intended, do you know of any others, with just basic functionality.

Thanks,
Jacob.
 
Old 09-29-2014, 03:08 AM   #5
balabit
syslog-ng documentation maintainer at BalaBit
 
Registered: Jun 2009
Posts: 16

Rep: Reputation: 2
Try filtering on the program name instead of the message:

filter f_sendpage {
program("%ASA-5-722033") or program("%ASA-6-722022"); };

If that string is parsed as the programname, this filter should catch it.

Regards,

Robert
 
  


Reply

Tags
syslog


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Syslog-ng :: Filter internal logs Rahil Parikh Linux - Server 7 10-21-2011 11:08 AM
syslog-ng filter JonDoe Linux - Server 8 10-19-2011 05:24 AM
Filter syslog razzera Debian 3 01-17-2011 05:43 PM
How to filter in syslog output LinuxLover Solaris / OpenSolaris 1 05-17-2010 02:12 PM
How to filter PA/module-alsa-sink.c messages from syslog sixerjman Linux - Software 2 05-05-2009 10:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration