[ZBX-10001] misleading duplicated log lines for housekeeper Created: 2015 Oct 26  Updated: 2017 May 30  Resolved: 2015 Dec 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 2.4.6, 3.0.0alpha4
Fix Version/s: 3.0.0alpha5

Type: Incident report Priority: Minor
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: housekeeper, logging, troubleshooting
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Run housekeeper in DebugLevel=4, notice 2 duplicated lines after housekeeper activity:

 6384:20151026:170613.154 housekeeper [deleted 375 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 0.212998 sec, idle for 1 hour(s)]
  6384:20151026:170613.154 housekeeper [deleted 375 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 0.212998 sec, idle for 1 hour(s)] 

They may mislead as with DbugLevel=3 we see only one such line.

The problem is in a function:

void	__zbx_zbx_setproctitle(const char *fmt, ...)
{
#if defined(HAVE_FUNCTION_SETPROCTITLE) || defined(PS_OVERWRITE_ARGV) || defined(PS_PSTAT_ARGV)
    char	title[MAX_STRING_LEN];
    va_list	args;

    va_start(args, fmt);
    zbx_vsnprintf(title, sizeof(title), fmt, args);
    va_end(args);

    zabbix_log(LOG_LEVEL_DEBUG, "%s", title);
#endif

which prints the same line as it gets in an input.

I'd suggest to add a prefix before value, for example "process title set: "

zabbix_log(LOG_LEVEL_DEBUG, "process title set: %s", title);


 Comments   
Comment by Oleksii Zagorskyi [ 2015 Oct 26 ]

It will help for many other cases too, for example where in Debug log a single line may look a bit unexpected, like:

 27180:20151026:180541.042 housekeeper [removing old history and trends]
...
 27180:20151026:180541.043 housekeeper [removing deleted items data]
...
 27180:20151026:180541.044 housekeeper [removing old events]

and not for housekeeper process only !

Comment by Viktors Tjarve [ 2015 Nov 16 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-10001

Comment by Oleksii Zagorskyi [ 2015 Nov 16 ]

Discussed with Viktors suggested changes. I'd still go for the simple change I suggested in description.
Maybe just worth to combine the long string

 ("%s [deleted %d hist/trends, %d items, %d events, %d sessions, %d alarms, %d audit "
				"items in " ZBX_FS_DBL " sec, %s]",
				get_process_type_string(process_type), d_history_and_trends, d_cleanup, d_events,
				d_sessions, d_services, d_audit, sec, sleeptext)

to a variable and then use it in zabbix_log and zbx_setproctitle calls.

Comment by Viktors Tjarve [ 2015 Nov 17 ]

Simplified fix in development branch svn://svn.zabbix.com/branches/dev/ZBX-10001 r56762

Comment by Oleksii Zagorskyi [ 2015 Nov 17 ]

I like the change now, in general it's what I've requested for.

Comment by Andris Zeila [ 2015 Nov 20 ]

Successfully tested

Comment by Viktors Tjarve [ 2015 Nov 20 ]

Released in:

  • pre-3.0.0alpha5 r56833
Comment by Aleksandrs Saveljevs [ 2015 Nov 20 ]

(1) This breaks formatting a bit:

 	char	title[MAX_STRING_LEN];
+	const char	*__function_name = "__zbx_zbx_setproctitle";
 	va_list	args;

By convention, __function_name should be the first variable definition in a funtion and variable names should be aligned, too.

asaveljevs It should also be discussed whether we should always have an "End of %s()" line if we have "In %s()" line.

zalex_ua Good point, it indeed can be suspicious that for some functions we can see both "In ..." and "End of ..." but for other functions we see only "In ..."
I, as an user who loves to investigate zabbix debuglogs, could suggest is to use "Start of ..." and "End of ...." text in cases when we log both lines and use "In ..." if we need to log only one line as this function does not have to much things to worth log on start and on end

viktors.tjarve Maybe in this case it is acceptable to leave it without "In" or "Start" and simply have it as:

zabbix_log(LOG_LEVEL_DEBUG, "%s() title:'%s'", __function_name, title);

viktors.tjarve RESOLVED in development brunch svn://svn.zabbix.com/branches/dev/ZBX-10001 r56983.

asaveljevs Looks good! CLOSED.

viktors.tjarve Released in:

  • pre-3.0.0alpha5 r57001
Generated at Fri Apr 19 17:17:21 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.