logrotate.h 2.01 KB
Newer Older
1 2 3 4
#ifndef H_LOGROTATE
#define H_LOGROTATE

#include <sys/types.h>
5
#include <sys/queue.h>
6 7
#include <glob.h>

8 9
#include "config.h"

10 11 12 13 14 15
#define LOG_FLAG_COMPRESS	(1 << 0)
#define LOG_FLAG_CREATE		(1 << 1)
#define LOG_FLAG_IFEMPTY	(1 << 2)
#define LOG_FLAG_DELAYCOMPRESS	(1 << 3)
#define LOG_FLAG_COPYTRUNCATE	(1 << 4)
#define LOG_FLAG_MISSINGOK	(1 << 5)
16 17
#define LOG_FLAG_MAILFIRST	(1 << 6)
#define LOG_FLAG_SHAREDSCRIPTS	(1 << 7)
18
#define LOG_FLAG_COPY		(1 << 8)
19 20
#define LOG_FLAG_DATEEXT	(1 << 9)
#define LOG_FLAG_SHRED		(1 << 10)
21 22
#define LOG_FLAG_SU			(1 << 11)
#define LOG_FLAG_DATEYESTERDAY	(1 << 12)
23 24 25 26

#define NO_MODE ((mode_t) -1)
#define NO_UID  ((uid_t) -1)
#define NO_GID  ((gid_t) -1)
27 28 29 30

#define NO_FORCE_ROTATE 0
#define FORCE_ROTATE    1

31 32 33
struct logInfo {
    char *pattern;
    char **files;
34
    int numFiles;
35
    char *oldDir;
36 37
    enum { ROT_HOURLY, ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_YEARLY, ROT_SIZE
            } criterium;
38
    unsigned long long threshhold;
39
	unsigned long long maxsize;
40
    unsigned long long minsize;
41
    int rotateCount;
42
    int rotateAge;
43
    int logStart;
44
    char *pre, *post, *first, *last, *preremove;
45 46 47 48 49 50
    char *logAddress;
    char *extension;
    char *compress_prog;
    char *uncompress_prog;
    char *compress_ext;
	char *dateformat;		/* specify format for strftime (for dateext) */
51
    int flags;
52
	int shred_cycles;		/* if !=0, pass -n shred_cycles to GNU shred */
53 54 55
    mode_t createMode;		/* if any/all of these are -1, we use the */
    uid_t createUid;		/* attributes from the log file just rotated */
    gid_t createGid;
56 57
    uid_t suUid;			/* switch user to this uid and group to this gid */
    gid_t suGid;
58
    /* these are at the end so they end up nil */
59
    const char **compress_options_list;
60
    int compress_options_count;
61 62
    TAILQ_ENTRY(logInfo) list;
};
63

64
TAILQ_HEAD(logInfoHead, logInfo) logs;
65

66
extern int numLogs;
67 68
extern int debug;

69
int readAllConfigPaths(const char **paths);
70
#if !defined(asprintf) && !defined(_FORTIFY_SOURCE)
71 72
int asprintf(char **string_ptr, const char *format, ...);
#endif
73

74
#endif