From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci/modules/log LogParser.cpp
Date: 8 Nov 2006 20:14:21 -0000 [thread overview]
Message-ID: <20061108201421.5922.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-11-08 20:14:21
Modified files:
ricci/modules/log: LogParser.cpp
Log message:
make the log module ignore files whose mtime is older than current time minus max age
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/log/LogParser.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8
--- conga/ricci/modules/log/LogParser.cpp 2006/10/23 18:43:35 1.7
+++ conga/ricci/modules/log/LogParser.cpp 2006/11/08 20:14:21 1.8
@@ -165,7 +165,8 @@
set<String>&
get_files(const String& path_,
- set<String>& files)
+ set<String>& files,
+ time_t age_time)
{
String path = utils::rstrip(utils::strip(path_), "/");
if (path.empty() || path.find_first_of(" ; & $ ` ? > < ' \" ; | \\ * \n \t") != path.npos)
@@ -178,11 +179,12 @@
// throw String("unable to stat ") + path;
return files;
if (S_ISREG(st.st_mode)) {
- files.insert(path);
+ if (st.st_mtime >= age_time)
+ files.insert(path);
// get rotated logs
for (int i=0; i<25; i++)
- get_files(path + "." + utils::to_string(i), files);
+ get_files(path + "." + utils::to_string(i), files, age_time);
return files;
} else if (S_ISDIR(st.st_mode))
@@ -204,7 +206,7 @@
if (kid_path == "." || kid_path == "..")
continue;
kid_path = path + "/" + kid_path;
- get_files(kid_path, files);
+ get_files(kid_path, files, age_time);
}
} catch ( ... ) {
closedir(d);
@@ -366,6 +368,13 @@
const list<String>& paths)
{
set<LogEntry> ret;
+ time_t age_time = time(NULL);
+
+ if ((long long) age_time - age < 0)
+ age_time = 0;
+ else
+ age_time -= age;
+
// set of requested tags
set<String> req_tags(domains.begin(), domains.end());
@@ -375,10 +384,10 @@
for (list<String>::const_iterator iter = paths.begin();
iter != paths.end();
iter++)
- get_files(*iter, files);
+ get_files(*iter, files, age_time);
if (files.empty()) {
- get_files("/var/log/messages", files);
- get_files("/var/log/syslog", files);
+ get_files("/var/log/messages", files, age_time);
+ get_files("/var/log/syslog", files, age_time);
}
// process log files
next reply other threads:[~2006-11-08 20:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-08 20:14 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-02-05 21:40 [Cluster-devel] conga/ricci/modules/log LogParser.cpp kupcevic
2007-02-05 21:25 kupcevic
2006-08-15 0:00 kupcevic
2006-08-11 16:27 kupcevic
2006-06-14 21:18 kupcevic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061108201421.5922.qmail@sourceware.org \
--to=rmccabe@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.