Hi Peter,

I tried to separate my code into 2 lines. That doesn’t help.

Then I tried the following:

  set $.oc_user_name_wb=exec_template("oc_username");
  set $.oc_user_name_tmp=replace($.oc_user_name_wb,"[","");
  set $.oc_user_name=replace($.oc_user_name_tmp,"]","“);

It's not pretty, but it works…  

Mit freundlichem Gruß,

Oliver Neumann

MSc Informatik
Oliver Neumann
Alexanderstrasse 1
20099 Hamburg

[email protected]
t +49 40 42875 8152



> Am 03.12.2018 um 16:25 schrieb Peter Viskup via rsyslog 
> <[email protected]>:
> 
> 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.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
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