[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to stop escaping in syslog (rsyslog and sysklogd)



Good day ,.

I'm searching for a way to stop the escaping of rsyslog for example if i send a message that include \n it is described as "#012" :

/**
 * Lets test the newlinje issues and the Length
 */

#include <stdio.h>
#include <unistd.h>
#include <syslog.h>
#include <stdlib.h>

int main(void) {
 char * foo ;
 int i = 0;
 foo = (char *  ) malloc (sizeof(*foo) * 2000 ) ;
 for ( i= 0 ;i < 2000; i++ ){
    if (i % 10 == 0) foo[i] = '\n';
    else foo[i] = i % 10 + '0';
 }
 openlog("test", LOG_PID|LOG_CONS, LOG_USER);
 /**
  * This should print 6 new lines and and not only one
  */
 syslog(LOG_INFO, "Lets test new lines \n\n\n\n\n\n .");

 closelog();

 return 0;
}

But i get message that include #012 instead of \n  :

Sep  3 11:31:10 lammer test[10153]: Lets test new lines #012#012#012#012#012#012 .

How can it be done ? (to prevent the escaping) ?

I also tried adding the line "[enc="us-ascii" lang="en"]" inside the message and it didn't help ether.



Reply to: