title: Getting time of logs stored in ASL log files with ASL API -Objective C
body: <p>As we know , we can use ASL (Apple System Logger) API in objective C to read logs and also with using asl_search it is possible to retrieve specific application logs. 
  But the problem is output of asl does not include the time when the log was created. 
  For example , when you open system.log in directory /var/log with Apple System Logger ,you see logs like this : </p>
  
  <blockquote>
    <p><strong>Nov 28 09:19:37 localhost bootlog[0]: BOOT_TIME 1354123177 0</strong></p>
  </blockquote>
  
  <p>But when quering asl with objective C , it reports every attribute of log except the time when the log is created, it means in example mentioned above , asl_search does not report Nov 28 09:19:37<br>
  Is there anyway to include time of creating logs with quering asl in objective C?
  If this is not possible , what is another approach to retrieving time of logs?</p>
  
  <hr>
  
  <p>This is my code , note that the time of logs which we can see in system.log files in /var/log does not appear in output of my code .</p>
  
  <p>int main (int argc, const char * argv[])
  {</p>
  
  <pre><code>NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  aslmsg q, m;
  int i;
  const char *key, *val;
  q = asl_new(ASL_TYPE_QUERY);
  asl_set_query(q, ASL_KEY_SENDER, "bootlog", ASL_QUERY_OP_EQUAL);
  
  aslresponse r = asl_search(NULL, q);
  
  while (NULL != (m = aslresponse_next(r)))
  {
      NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
  
      for (i = 0; (NULL != (key = asl_key(m, i))); i++)
      {
          NSString *keyString = [NSString stringWithUTF8String:(char *)key];
  
          val = asl_get(m, key);
  
          NSString *string = [NSString stringWithUTF8String:val];
          [tmpDict setObject:string forKey:keyString];
      }
  
      NSLog(@"%@", tmpDict);
  
  }
  aslresponse_free(r);
  
  [pool drain];
  return 0;
  </code></pre>
  
  <p>}</p>