Hi,
Kerneloops scanner should scan syslog at startup once and then dmesg regularly. Original
implementation inverted this. Please see patch. Any comments?
---
abrt-1.0.6/lib/Plugins/KerneloopsScanner.cpp.org 2010-02-20 16:48:21.227128064 +0000
+++ abrt-1.0.6/lib/Plugins/KerneloopsScanner.cpp 2010-02-20 16:51:29.436625307 +0000
@@ -39,22 +39,37 @@
CKerneloopsScanner::CKerneloopsScanner()
{
int cnt_FoundOopses;
+ const char *syslog_file = "/var/log/messages";
+ map_plugin_settings_t::const_iterator it = m_pSettings.find("SysLogFile");
+ if (it != m_pSettings.end()) {
+ syslog_file = it->second.c_str();
+ }
- /* Scan dmesg, on first call only */
- cnt_FoundOopses = ScanDmesg();
- if (cnt_FoundOopses > 0)
+ /* Scan syslog, on first call only */
+ cnt_FoundOopses = ScanSysLogFile(syslog_file);
+ if (cnt_FoundOopses > 0) {
SaveOopsToDebugDump();
+ /*
+ * This marker in syslog file prevents us from
+ * re-parsing old oopses (any oops before it is
+ * ignored by ScanSysLogFile()). The only problem
+ * is that we can't be sure here that syslog_file
+ * is the file where syslog(xxx) stuff ends up.
+ */
+ openlog("abrt", 0, LOG_KERN);
+ syslog(
+ LOG_WARNING,
+ "Kerneloops: Reported %u kernel oopses to Abrt",
+ cnt_FoundOopses
+ );
+ closelog();
+ }
}
void CKerneloopsScanner::Run(const char *pActionDir, const char *pArgs, int force)
{
- const char *syslog_file = "/var/log/messages";
- map_plugin_settings_t::const_iterator it = m_pSettings.find("SysLogFile");
- if (it != m_pSettings.end()) {
- syslog_file = it->second.c_str();
- }
- int cnt_FoundOopses = ScanSysLogFile(syslog_file);
+ int cnt_FoundOopses = ScanDmesg();
if (cnt_FoundOopses > 0) {
SaveOopsToDebugDump();
/*
Peter