1 /*
2 ** Zabbix
3 ** Copyright (C) 2001-2021 Zabbix SIA
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 **/
19 
20 #ifndef ZABBIX_LOGFILES_H
21 #define ZABBIX_LOGFILES_H
22 
23 #include "zbxregexp.h"
24 #include "md5.h"
25 
26 struct	st_logfile
27 {
28 	char		*filename;
29 	int		mtime;		/* st_mtime from stat() */
30 	int		md5size;	/* size of the initial part for which the md5 sum is calculated */
31 	int		seq;		/* number in processing order */
32 	int		retry;
33 	int		incomplete;	/* 0 - the last record ends with a newline, 1 - the last record contains */
34 					/* no newline at the end */
35 	zbx_uint64_t	dev;		/* ID of device containing file */
36 	zbx_uint64_t	ino_lo;		/* UNIX: inode number. Microsoft Windows: nFileIndexLow or FileId.LowPart */
37 	zbx_uint64_t	ino_hi;		/* Microsoft Windows: nFileIndexHigh or FileId.HighPart */
38 	zbx_uint64_t	size;		/* st_size from stat() */
39 	zbx_uint64_t	processed_size;	/* how far the Zabbix agent has analyzed the file */
40 	md5_byte_t	md5buf[MD5_DIGEST_SIZE];	/* md5 sum of the initial part of the file */
41 };
42 
43 int	process_logrt(unsigned char flags, const char *filename, zbx_uint64_t *lastlogsize, int *mtime,
44 		zbx_uint64_t *lastlogsize_sent, int *mtime_sent, unsigned char *skip_old_data, int *big_rec,
45 		int *use_ino, char **err_msg, struct st_logfile **logfiles_old, int *logfiles_num_old,
46 		const char *encoding, zbx_vector_ptr_t *regexps, const char *pattern, const char *output_template,
47 		int *p_count, int *s_count, zbx_process_value_func_t process_value, const char *server,
48 		unsigned short port, const char *hostname, const char *key);
49 
50 #endif
51