static int get_log_value(log_result_t *result, int index, char **value, int *state, zbx_uint64_t *lastlogsize, int *mtime)
** Copyright (C) 2001-2025 Zabbix SIA
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#cgo CFLAGS: -I${SRCDIR}/../../../../include
#include "../src/zabbix_agent/metrics.h"
#include "../src/zabbix_agent/logfiles/logfiles.h"
extern int CONFIG_MAX_LINES_PER_SECOND;
typedef ZBX_ACTIVE_METRIC* ZBX_ACTIVE_METRIC_LP;
typedef zbx_vector_ptr_t * zbx_vector_ptr_lp_t;
typedef char * char_lp_t;
typedef zbx_vector_pre_persistent_t * zbx_vector_pre_persistent_lp_t;
ZBX_ACTIVE_METRIC *new_metric(char *key, zbx_uint64_t lastlogsize, int mtime, int flags)
ZBX_ACTIVE_METRIC *metric = malloc(sizeof(ZBX_ACTIVE_METRIC));
memset(metric, 0, sizeof(ZBX_ACTIVE_METRIC));
// key_orig is used in error messages, consider using "itemid: <itemid>" instead of the key
metric->key_orig = zbx_strdup(NULL, key);
metric->lastlogsize = lastlogsize;
metric->flags = (unsigned char)flags;
metric->skip_old_data = (0 != metric->lastlogsize ? 0 : 1);
metric->persistent_file_name = NULL; // initialized but not used in Agent2
void metric_set_refresh(ZBX_ACTIVE_METRIC *metric, int refresh)
metric->refresh = refresh;
void metric_get_meta(ZBX_ACTIVE_METRIC *metric, zbx_uint64_t *lastlogsize, int *mtime)
*lastlogsize = metric->lastlogsize;