Addtional to that question. 

Is it not possible to overwrite the template variable mailsubject ?

I switch the state of things with "if" but the mailsubject was set ones will 
not change(Example 1). Or If I try to set it via IF I got an syntax error 
(example 2). 

Please advice :-/

Example 1. 
###SET MAILJUBJECT 
template (name="mailSubject" type="string" string="%hostname% ERROR 1 USER 
ACCESS DENIED")

### ACTION IF STATE FOUND
if $msg contains "Invalid Credentials" then {...
...

### SET MAILSUBJECT
template (name="mailSubject" type="string" string="%hostname% OVERWIRTE THE 
MAILSUBJECT IN CASE OF OTHER EVENT")
### ACTION IF STATE FOUND
if $msg contains "OTHER EVENT" then {...
...
.

Example 2 
### ACTION IF STATE FOUND
if $msg contains "Invalid Credentials" then {

### SET MAILSUBJECT IF STATE FOUND
template (name="mailSubject" type="string" string="%hostname% ERROR 1 USER 
ACCESS DENIED")
...
..
.
#>sudo service rsyslog restart.
error during parsing file /etc/rsyslog.d/10-netscaler.conf, on or before line 
30: syntax error on token 'template ('



-----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

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 "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")

}


Hi,

I would like to modifi the mail Subject on spezific event containing text and 
the %hostname% variable.

Is this not posiible ?

THANKS
_______________________________________________
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.

Reply via email to