Re: asl_search() no longer returns old messages
Re: asl_search() no longer returns old messages
- Subject: Re: asl_search() no longer returns old messages
- From: Jason Coco <email@hidden>
- Date: Mon, 3 Nov 2008 11:16:00 -0500
On Nov 3, 2008, at 11:01 , Karl Moskowski wrote:
Last week, I started converting my app to use ASL, and everything
was hunky dory. For diagnostic purposes, I use an ASL query to
export to text for upload recent logs.
// really, days & flag are passed in to a method
double days = 30.0; // varies from 1.0 to 30.0
NSString *minLevel = [NSString stringWithFormat:@"%u", (flag ?
ASL_LEVEL_ERR : ASL_LEVEL_NOTICE)];
NSCalendarDate *startDate = [NSCalendarDate
dateWithTimeIntervalSinceNow:-24.0*60.0*60.0*days];
NSString *logSince = [NSString stringWithFormat:@"%.0f", [startDate
timeIntervalSince1970]];
aslmsg query = asl_new(ASL_TYPE_QUERY);
asl_set_query(query, ASL_KEY_SENDER, "MyApp", ASL_QUERY_OP_EQUAL);
asl_set_query(query, ASL_KEY_TIME, [logSince UTF8String],
ASL_QUERY_OP_GREATER_EQUAL);
asl_set_query(query, ASL_KEY_LEVEL, [minLevel UTF8String],
ASL_QUERY_OP_LESS_EQUAL | ASL_QUERY_OP_NUMERIC);
aslresponse response = asl_search(client, query);
asl_free(query);
aslmsg message = NULL;
while ((message = aslresponse_next(response)) != NULL) {
// format and append the message
}
aslresponse_free(response);
asl_close(client);
// return the message
Today, I fired up Xcode to continue working, and I noticed my
queries no longer return any messages before this morning's reboot.
The only thing I can think of is that, since last week, the periodic
weekly script ran this morning. Does this script prune the ASL
database? Is there another way to go further back in time with ASL?
Yes... by default messages are pruned every 24 hours by syslog. See
the section on Messaging Expiry and Archival in the manpage for
syslogd(8) for more information on how to adjust this...
J
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden