Replying myself....

It seems you need to redefine the generic template in the rsyslog.conf
adding these pri-text:

$template TraditionalFormatWithPRI,"%pri-text%: %timestamp% %HOSTNAME%
%syslogtag%%msg:::drop-last-lf%\n"
$ActionFileDefaultTemplate TraditionalFormatWithPRI

Now it works!

Xavi

On 2 February 2015 at 13:48, Xavier Fustero <[email protected]> wrote:

> Hi,
>
> I am trying to fill my logs files with more information when debugging
> applications. I am currently having application filtered locally using
> different templates and creating dynamic files from these.
>
> E.g.:
>
> template (name="rails_app" type="string"
> string="/var/log/rails/%programname%.log")
>
> if (($syslogfacility-text == 'local0' or $syslogfacility-text == 'local1')
>    and ($programname != 'p1' and $programname != 'p2' and
>    $programname != 'p3' and not ( $programname startswith 'p4'))) then {
>      action(type="omfile" DynaFile="rails_app")
>
> These produces logs like:
> Feb  2 12:42:05 my_host TagService[17793]: CloudAnalyticsSqsHelper:
> queue(ca_tag_denorm_staging), adding tags to resources.
> {"type"=>"add_tags", "version"=>1422880925, "account_id"=>"XXXXX",
> "rsids"=>["/clouds/2722/instances/DRRS"],
> "tags"=>["rs_login:state=restricted"]}
>
>
> I discard debug by default on my installation but if I remove my discard I
> would like to produce much more verbose output on my logs. I need they show
> facility-text and priority-text at least.
>
> I tried several things in the above template but I am not doing it
> correctly.
> I also uncomment this line from rsyslog.conf:
>
> # To enable high precision timestamps, comment out the following line.
> #
> $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
>
> expecting it magically would take this format by default but nothing
> changed.
>
> How can I tell the above template to use debug format or include the
> %syslogfacility-text% and %syslogpriority-text%?
>
> Thanks a log,
> Xavi
>
_______________________________________________
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