모든 로그 경로에 다시 쓰기를 삽입하는 대신 메시지의 일부를 전체적으로 다시 쓰는 방법이 있습니까?

모든 로그 경로에 다시 쓰기를 삽입하는 대신 메시지의 일부를 전체적으로 다시 쓰는 방법이 있습니까?

메시지에서 \n 이스케이프 처리해야 합니다. " "을(를) 사용하여 이 작업을 수행할 수 있지만 rewrite문제는 로그 경로가 많고 rewrite모든 로그 경로에 " "을 지정하고 싶지 않다는 것입니다. 재정의를 설정하는 전역 방법이 있습니까?

# Escape the new line characters
rewrite r_escape_new_line {subst("\n", "#012", value("MSG"), flags("global"));};
log { source(s_system); filter(f_critical); rewrite(r_escape_new_line); destination(d_critical); };
log { source(s_system); filter(f_error); rewrite(r_escape_new_line); destination(d_error); };
log { source(s_system); filter(f_warning); rewrite(r_escape_new_line); destination(d_warning); };

답변1

소스 정의에 flags(no-multi-line) 옵션을 추가해 보세요. 예를 들면 다음과 같습니다.

source s_src {
   system(flags(no-multi-line));
   internal();

};

그래도 작동하지 않으면 채널을 사용하여 재정의를 소스 정의에 포함할 수 있습니다. 이것syslog-ng 관리자 안내서비슷한 예가 있습니다. 파서를 재정의로 바꾸면 됩니다.

HTH.

관련 정보