> -----Original Message-----
> From: [email protected] [mailto:rsyslog-
> [email protected]] On Behalf Of Jonathan Sabo
> Sent: Friday, November 05, 2010 5:03 PM
> To: [email protected]
> Subject: Re: [rsyslog] substring matching in templates
> 
> I think I can do something like this:
> 
> %HOSTNAME:F,45:2%
> 
> To match my convention where the location is the suffix of the
> hostname seperated by a hyphen.  Ie web1-nyc
> 
> But how do you use this property replacer to construct a path name in
> a template.....

Just like you already did: put "%HOSTNAME:F,45:2%" into the template. ;) This
is where it is used.

Rainer
> 
> 
> 
> On Fri, Nov 5, 2010 at 10:42 AM, Jonathan Sabo <[email protected]>
> wrote:
> > List,
> >
> > I want to organise my central syslog server based on physical site
> > location.  I can obtain the physical site location by matching a
> > substring in the hostname message property.  How do you do that in
> > ryslog templates?  Given a known list of site names that are part of
> > the hostname for each system sending logs, what's the best way to
> > match that in the hostname and then place them in directories based
> on
> > that site name.
> >
> > /var/log/$sitename/$hostname/logs.log
> >
> > For example:
> >
> > web1-nyc
> >
> > Logs would placed in
> >
> > /var/log/nyc/web1-nyc/access.log
> >
> > I think I could say something like:
> >
> > $template NYCTemplate, /app/log/nyc/%HOSTNAME%/access.log
> >
> > if $hostname contains "nyc" then ?NYCTemplate
> >
> > But then I have to have each site name hard coded in the config...
> I
> > have a naming convention of typeNum-site so I would like it to be
> more
> > dynamic based on whatever follows the hyphen.   Is there a way to
> > match this convention and then just create the directory based on the
> > string following the hyphen instead of having to hard code the names
> > in the config?
> >
> > Thanks,
> >
> > Jonathan
> >
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
> http://www.rsyslog.com
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com

Reply via email to