how can split logs from device with two (or more) ip source

This is the place for you, if you got rsyslog up and running but wonder how to make it do what you want.

Moderator: rgerhards

how can split logs from device with two (or more) ip source

Postby segamo » Wed Dec 10, 2008 7:19 am

Hello,

how i can split logs from external edge device with two (or more) ip source?

i use rsyslog 4.1

/etc/hosts
1.1.1.1 edge1.dom1
2.2.2.2 edge1.dom2
3.3.3.3 edge2.dom2
4.4.4.4 edge2.dom2

/etc/rsyslog.conf
$template EDGE,"/var/log/edge/%HOSTNAME%.log"
if $fromhost contains 'edge' then ?EDGE

on the edge device only one interface active
and messages from single device (edge1) write to different files (edge1.dom1.log or edge1.dom2.log).

it is possible truncate domain in %HOSTNAME% ?
segamo
New
 
Posts: 3
Joined: Wed Dec 10, 2008 7:00 am

Professional Services Information

  • Custom written rsyslog.conf?
  • Maintenance Contract?
  • Installation support?

Re: how can split logs from device with two (or more) ip source

Postby hkspvt » Wed Dec 10, 2008 7:58 pm

I don't know whether this will work, but you may be able to make use of the field extraction functions in the property replacer.

http://www.rsyslog.com/doc-property_replacer.html

Something like this:

$template EDGE,"/var/log/edge/%hostname:R,ERE,1,FIELD:([a-zA-z0-9]*)\.--end%.log"

-HKS
hkspvt
Frequent Poster
 
Posts: 125
Joined: Thu Jun 26, 2008 6:31 pm

Re: how can split logs from device with two (or more) ip source

Postby segamo » Thu Dec 11, 2008 5:35 am

hkspvt wrote:$template EDGE,"/var/log/edge/%hostname:R,ERE,1,FIELD:([a-zA-z0-9]*)\.--end%.log"


thank you very much
it's working
segamo
New
 
Posts: 3
Joined: Wed Dec 10, 2008 7:00 am

Re: how can split logs from device with two (or more) ip source

Postby segamo » Wed Aug 05, 2009 12:07 pm

if i using rsyslogd 4.1.2 (devel) - working fine

if runing this config with rsyslogd 4.2.0 (stable) - don't working.
rsyslog 4.2.0 create one file /var/log/edge/2009.log with messages from all devices.

my config:
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$template EDGE,"/var/log/edge/%hostname:R,ERE,1,FIELD:([a-zA-z0-9]*)\.--end%.log"
if $fromhost contains '.edge.' then ?EDGE
segamo
New
 
Posts: 3
Joined: Wed Dec 10, 2008 7:00 am

Google Ads



Return to Configuration

Who is online

Users browsing this forum: No registered users and 0 guests

cron