templates are not variables, they don't get re-evaluated as you process each
message, they are fixed items that are evaluated at startup time.
David Lang
On Mon, 6 Aug 2018, Till Brinkmann wrote:
Date: Mon, 6 Aug 2018 09:26:06 +0000
From: Till Brinkmann <[email protected]>
Reply-To: rsyslog-users <[email protected]>
To: rsyslog-users <[email protected]>
Subject: Re: [rsyslog] [EXTERNAL] Re: rsyslog subject.template mailSubject
Hello Lennard thank you for your replay that is not accectly what I trying to
do but it will fits my needs.
I wonder why I can not redefinde the variable / template mailSubject and need
to create a new one. But no problem with that main thing it works 😃
Greetings Till
-----Ursprüngliche Nachricht-----
Von: rsyslog [mailto:[email protected]] Im Auftrag von Lennard
Klein via rsyslog
Gesendet: Montag, 6. August 2018 11:15
An: [email protected]
Cc: Lennard Klein <[email protected]>
Betreff: Re: [rsyslog] [EXTERNAL] Re: rsyslog subject.template mailSubject
Hi,
I don't exactly understand your latest mail, but looking at your original mail
I would suggest defining 2 templates rather than 1, instead of trying to
redefine the template. I've typed up the general idea below.
On 08/06/2018 10:14 AM, Till Brinkmann wrote:
...
-----Ursprüngliche Nachricht-----
Von: rsyslog [mailto:[email protected]] Im Auftrag von
Till Brinkmann
Gesendet: Donnerstag, 2. August 2018 16:36
An: eSX <[email protected]>; [email protected]
Betreff: [rsyslog] rsyslog subject.template mailSubject
module(load="ommail")
template (name="mailBody" type="string" string="RSYSLOG Alert
nmsg='%msg%'") > template (name="mailSubject" type="string"
string="%hostname%") <<<<
HOSTNAME STILL THE SAME BUT TEXT WILL CHANGE OF EVENT IF
Instead, use this:
template (name="mailSubjectINVALID"
type="string"
string="%hostname% INVALID CRED") template (name="mailSubjectSUCCESS"
type="string"
string="%hostname% USER LOGIN SUCESS")
if $msg contains "Invalid Credentials" then {
action(type="ommail" server="localhost" port="25"
mailfrom="[email protected]"
mailto="[email protected]"
subject.template="mailSubject" <<<<<<<< WOULD LIKE TO USE
TEXT AND THE %HOSTNAME% VAR HERE %HOSTANME INVALID CRED.
body.enable="on"
template="mailBody")
if $msg contains "Invalid Credentials" then {
action( ...
subject.template="mailSubjectINVALID"
...
}
}
if $msg contains "SUCCESS" then {
action(type="ommail" server="localhost" port="25"
mailfrom="[email protected]"
mailto="[email protected]"
subject.template="mailSubject" <<<<<<<< WOULD LIKE TO USE
TEXT AND THE %HOSTNAME% VAR HERE %HOSTNAME% USER LOGIN SUCESS
body.enable="on"
template="mailBody")
}
if $msg contains "SUCCESS" then {
action( ...
subject.template="mailSubjectSUCCESS"
...
}
regards,
Lennard
This email is from Equinix (EMEA) B.V. or one of its associated companies in
the territory from where this email has been sent. This email, and any files
transmitted with it, contains information which is confidential, is solely for
the use of the intended recipient and may be legally privileged. If you have
received this email in error, please notify the sender and delete this email
immediately. Equinix (EMEA) B.V.. Registered Office: Amstelplein 1, 1096 HA
Amsterdam, The Netherlands. Registered in The Netherlands No. 57577889.
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards NOTE WELL: This is
a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our
control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE
THAT.
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE
THAT.