xymon

Check-in [8edb8f41d7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Backport logfetch r6811 from trunk git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.19@7603 44351d6e-118b-4698-b696-ce33095ecaa4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | origin/4.3.19
Files: files | file ages | folders
SHA3-256: 8edb8f41d78258a70d1a98e4ac87e69991c717da050bc101d1b10c37c17c9dbd
User & Date: jccleaver@users.sf.net 2015-03-21 09:58:00
Context
2015-03-21
10:22
logfetch: Ensure multiple triggerline blocks get sent in low maxbyte situations (From Franco Gasperino) git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.19@7604 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 87c83232b4 user: jccleaver@users.sf.net tags: trunk, origin/4.3.19
09:58
Backport logfetch r6811 from trunk git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.19@7603 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 8edb8f41d7 user: jccleaver@users.sf.net tags: trunk, origin/4.3.19
00:01
add acknowledgements.sh report (Thanks, Andy Smith) git-svn-id: http://svn.code.sf.net/p/xymon/code/branches/4.3.19@7602 44351d6e-118b-4698-b696-ce33095ecaa4 check-in: 523b41d601 user: jccleaver@users.sf.net tags: trunk, origin/4.3.19
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to client/logfetch.c.

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

	/*
	 * See how large the file is, and decide where to start reading.
	 * Save the last POSCOUNT positions so we can scrap 5 minutes of data
	 * from one run to the next.
	 */
	fstat(fileno(fd), &st);
	if ((st.st_size < logdef->lastpos[0]) || (st.st_size < logdef->lastpos[6])) {
		/*
		 * Logfile shrank - probably it was rotated.
		 * Start from beginning of file.
		 */
		for (i=0; (i < 7); i++) logdef->lastpos[i] = 0;
	}

	/* Go to the position we were at 6 times ago (corresponds to 30 minutes) */
#ifdef _LARGEFILE_SOURCE
	fseeko(fd, logdef->lastpos[6], SEEK_SET);
	bufsz = st.st_size - ftello(fd);
	if (bufsz > MAXCHECK) {
		/*
		 * Too much data for us. We have to skip some of the old data.
		 */
		logdef->lastpos[6] = st.st_size - MAXCHECK;
		fseeko(fd, logdef->lastpos[6], SEEK_SET);
		bufsz = st.st_size - ftello(fd);
	}
#else
	fseek(fd, logdef->lastpos[6], SEEK_SET);
	bufsz = st.st_size - ftell(fd);
	if (bufsz > MAXCHECK) {
		/*
		 * Too much data for us. We have to skip some of the old data.
		 */
		logdef->lastpos[6] = st.st_size - MAXCHECK;
		fseek(fd, logdef->lastpos[6], SEEK_SET);
		bufsz = st.st_size - ftell(fd);
	}
#endif

	/* Shift position markers one down for the next round */
	for (i=6; (i > 0); i--) logdef->lastpos[i] = logdef->lastpos[i-1];
	logdef->lastpos[0] = st.st_size;

	/*
	 * Get our read buffer.
	 *
	 * NB: fgets() need some extra room in the input buffer.
	 *     If it is missing, we will never detect end-of-file 







|




|


|

|





|
|



|





|
|





|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

	/*
	 * See how large the file is, and decide where to start reading.
	 * Save the last POSCOUNT positions so we can scrap 5 minutes of data
	 * from one run to the next.
	 */
	fstat(fileno(fd), &st);
	if ((st.st_size < logdef->lastpos[0]) || (st.st_size < logdef->lastpos[POSCOUNT-1])) {
		/*
		 * Logfile shrank - probably it was rotated.
		 * Start from beginning of file.
		 */
		for (i=0; (i < POSCOUNT); i++) logdef->lastpos[i] = 0;
	}

	/* Go to the position we were at POSCOUNT-1 times ago (corresponds to 30 minutes) */
#ifdef _LARGEFILE_SOURCE
	fseeko(fd, logdef->lastpos[POSCOUNT-1], SEEK_SET);
	bufsz = st.st_size - ftello(fd);
	if (bufsz > MAXCHECK) {
		/*
		 * Too much data for us. We have to skip some of the old data.
		 */
		logdef->lastpos[POSCOUNT-1] = st.st_size - MAXCHECK;
		fseeko(fd, logdef->lastpos[POSCOUNT-1], SEEK_SET);
		bufsz = st.st_size - ftello(fd);
	}
#else
	fseek(fd, logdef->lastpos[POSCOUNT-1], SEEK_SET);
	bufsz = st.st_size - ftell(fd);
	if (bufsz > MAXCHECK) {
		/*
		 * Too much data for us. We have to skip some of the old data.
		 */
		logdef->lastpos[POSCOUNT-1] = st.st_size - MAXCHECK;
		fseek(fd, logdef->lastpos[POSCOUNT-1], SEEK_SET);
		bufsz = st.st_size - ftell(fd);
	}
#endif

	/* Shift position markers one down for the next round */
	for (i=POSCOUNT-1; (i > 0); i--) logdef->lastpos[i] = logdef->lastpos[i-1];
	logdef->lastpos[0] = st.st_size;

	/*
	 * Get our read buffer.
	 *
	 * NB: fgets() need some extra room in the input buffer.
	 *     If it is missing, we will never detect end-of-file