you cannot redefine a template, if you try, only one version will take effect (I
think the last one evaluated in the file)
David Lang
On Mon, 6 Aug 2018, Lennard Klein via rsyslog wrote:
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.