소스 검색

core: new global parameter corelog

- control the log level for non-critical core error messages
- e.g., useful to disable messages such as:
	- tcp connection reset by peer
	- error parsing received message for garbage (non-sip/html/...)
Daniel-Constantin Mierla 14 년 전
부모
커밋
7e2e4ff449
5개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 0
      cfg.lex
  2. 3 0
      cfg.y
  3. 4 1
      cfg_core.c
  4. 1 0
      cfg_core.h
  5. 1 0
      etc/kamailio.cfg

+ 2 - 0
cfg.lex

@@ -386,6 +386,7 @@ SYN_BRANCH syn_branch
 MEMLOG		"memlog"|"mem_log"
 MEMDBG		"memdbg"|"mem_dbg"
 MEMSUM		"mem_summary"
+CORELOG		"corelog"|"core_log"
 SIP_WARNING sip_warning
 SERVER_SIGNATURE server_signature
 SERVER_HEADER server_header
@@ -747,6 +748,7 @@ SUBST       subst
 <INITIAL>{MEMLOG}	{ count(); yylval.strval=yytext; return MEMLOG; }
 <INITIAL>{MEMDBG}	{ count(); yylval.strval=yytext; return MEMDBG; }
 <INITIAL>{MEMSUM}	{ count(); yylval.strval=yytext; return MEMSUM; }
+<INITIAL>{CORELOG}	{ count(); yylval.strval=yytext; return CORELOG; }
 <INITIAL>{SIP_WARNING}	{ count(); yylval.strval=yytext; return SIP_WARNING; }
 <INITIAL>{USER}		{ count(); yylval.strval=yytext; return USER; }
 <INITIAL>{GROUP}	{ count(); yylval.strval=yytext; return GROUP; }

+ 3 - 0
cfg.y

@@ -434,6 +434,7 @@ extern char *finame;
 %token MEMLOG
 %token MEMDBG
 %token MEMSUM
+%token CORELOG
 %token SIP_WARNING
 %token SERVER_SIGNATURE
 %token SERVER_HEADER
@@ -918,6 +919,8 @@ assign_stm:
 	| MEMDBG EQUAL error { yyerror("int value expected"); }
 	| MEMSUM EQUAL intno { default_core_cfg.mem_summary=$3; }
 	| MEMSUM EQUAL error { yyerror("int value expected"); }
+	| CORELOG EQUAL intno { default_core_cfg.corelog=$3; }
+	| CORELOG EQUAL error { yyerror("int value expected"); }
 	| SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
 	| SIP_WARNING EQUAL error { yyerror("boolean value expected"); }
 	| USER EQUAL STRING     {

+ 4 - 1
cfg_core.c

@@ -119,8 +119,9 @@ struct cfg_group_core default_core_cfg = {
 	-1,  /**< udp4_raw_ttl (auto detect by default) */
 	0,  /*!< force_rport */
 	L_DBG, /*!< memlog */
-	3 /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
+	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
 		4 pkg_sums, 8 shm_sums */
+	L_ERR /*!< corelog */
 };
 
 void	*core_cfg = &default_core_cfg;
@@ -307,5 +308,7 @@ cfg_def_t core_cfg_def[] = {
 		" 2 - dump all the shm used blocks (status),"
 		" 4 - summary of pkg used blocks,"
 		" 8 - summary of shm used blocks" },
+	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
+		"log level for non-critical core error messages"},
 	{0, 0, 0, 0, 0, 0}
 };

+ 1 - 0
cfg_core.h

@@ -108,6 +108,7 @@ struct cfg_group_core {
 	int force_rport; /*!< if set rport will always be forced*/
 	int memlog; /*!< log level for memory status/summary info */
 	int mem_summary; /*!< display memory status/summary info on exit */
+	int corelog; /*!< log level for non-critcal core error messages */
 };
 
 extern struct cfg_group_core default_core_cfg;

+ 1 - 0
etc/kamailio.cfg

@@ -123,6 +123,7 @@ log_stderror=no
 
 memdbg=5
 memlog=5
+corelog=-2
 
 log_facility=LOG_LOCAL0