I have a feed and I want to email the log entries from feeds_log after it has completed a run. I thought that if I could get the feed_id, I could query the db to get the log entries.

I'm using hook_feeds_after_import(), which gives me access to the $source object, but in looking through some documentation, I don't see a way to get the feed_id.

How can I get the log entries from a feed run?


From hook_feeds_after_import($source), I have access to $source->imported, which is the timestamp value in feeds_log.request_time. So I have

$result = db_query('SELECT message, variables FROM {feeds_log} WHERE request_time = :imported', array(':imported' => $source->imported) );

| improve this answer | |

you can always use:

function yourmodule_feeds_after_import(FeedsSource $source) {
  $feed_nid = $source->feed_nid;

Hope this helps

| improve this answer | |

If you have the module Views turned on there is a view provided by Feeds that has the path node/%nid/log where you can see the log.

If that is not what you wanted you could clone the view and adjust it to your settings.

If you want to code it instead you could always query the database. Have a look in feeds.install to see what the tables are named.

| improve this answer | |
  • Views is not a solution, I need to send out an email. Querying the database is exactly what I want to do. However I'll need to get the feed_id, because I don't want to email out the entire feeds history. – user1359 Aug 27 '12 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.