Hello Oliver,
try change line
set $!user_name = substring(exec_template("username"),2,4);
to lines:
set $!user_name_tmp = exec_template("username");
set $!user_name= substring($!user_name_tmp,2,4);

-- 
Peter
On Thu, Nov 22, 2018 at 3:49 PM Neumann, Oliver
<[email protected]> wrote:
>
> Hi there,
>
> I’m in trouble with generating user-based log files.
>
> template (name="user_file_name" type="string"
>   string="/srv/log/%$!user_name%.log"
> )
>
> template (name="username" type="string"
>   string="%msg:R,ERE,0,DFLT:\\[[a-z][a-z][0-9][0-9]\\]--end%"
> )
>
> set $!user_name = substring(exec_template("username"),2,4);
> action(type="omfile" name="cloud-audit" dynaFile="user_file_name" )
>
> Previous config should generate per user log-files with the path 
> /srv/log/ab12.log for example. But it generates only one log with 
> /srv/log/0.log.
>
> Using the set $!user_name without the substring function generates files like 
> /srv/log/[ab12].log what is nearly what i want, but without brackets.
>
> Any ideas how to remove those brackets?
>
> Sheers,
>
> Oli
>
>
>
> _______________________________________________
> 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