Pull logs

Can I get a script to export, extract or email the logs under Home > System Admin > View Logs from the last 1 hour.
Thanks

Hi Tieku, yes, this should be pretty easy to do. If we build it into Query Builder, then we can have a variable for the number of hours to include. Would that work for you? Ross.

That would be perfect. What are the options for getting the logs off the server automatically?

Let me explain what I am trying to do. I am setting up a demo Gibbon site for people interested in exploring Gibbon. Since I will allow a user to log in and make any changes they want, the site will reset every hour on the hour. What I am trying to do is gauge how many logins I am getting every hour throughout the day.

Tieku

Hi Tieku,

That sounds very interesting : ) Rather than Query Builder then, it might be best to just give you the raw SQL. You could build this into a PHP script that pulls out the relevant logs and inserts them into a spreadsheet.

The query you want is:

`SELECT
	*
FROM
	gibbonLog
WHERE 
	timestamp >= NOW() - INTERVAL 1 HOUR
	AND title LIKE 'Login%';`
```


Cheers,

Ross

Thanks for this. How different would Query Builder look. I’d like to see that as well. Thanks

In actual fact the above works in Query Builder as well. Were you saying you’d add this to the library?
Thanks

Hi Tieku, I’ve just added it to the Query Builder library with the name All Login Logs Within Last X Hours. Feel free to sync your queries and check it out : )