ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Export Control Panel Log?

October 01, 2010 8:56pm

Subscribe [3]
  • #1 / Oct 01, 2010 8:56pm

    Unifusion

    103 posts

    Hi there,

    I was just wondering if there was a way to export the Control Panel log. I have a client who needs to see who has been logging into the CP over the past few months, and I’d like to have a way of sending him the log in a file format.

    Thanks!

  • #2 / Oct 02, 2010 6:47am

    Andrew Weaver

    206 posts

    I don’t think there is anything built-in but you could do it with the query module in a template. Something like:

    {exp:query sql="SELECT exp_cp_log.username as cp_username, 
        exp_cp_log.ip_address as cp_ip_address, 
        exp_cp_log.act_date as cp_act_date, 
        exp_sites.site_label as cp_site_label,
        exp_cp_log.action as cp_action
    FROM exp_cp_log INNER JOIN exp_sites ON exp_cp_log.site_id = exp_sites.site_id
    ORDER BY exp_cp_log.act_date DESC"}"{cp_username}","{cp_ip_address}","{cp_act_date format="{DATE_W3C}"}","{cp_site_label}","{cp_action}"
    {/exp:query}

    should generate a CSV file in the the browser that could be opened in a spreadsheet.

    I’ve got a plugin - Export - that could also help generate the CSV file.

    Andrew

  • #3 / Oct 04, 2010 1:48am

    John Henry Donovan

    12339 posts

    Thanks for that Andrew. It is definitely worthy of the EE Wiki if you have time.

    Does that help you Unifusion?

  • #4 / Oct 04, 2010 12:27pm

    Unifusion

    103 posts

    Worked like a charm, the only issue I’m having is that the dates don’t seem to be exporting properly. For example, today’s date is generated as this:

    1286229209

    Any suggestions on how to get this to layman’s terms? Thanks a lot!

  • #5 / Oct 04, 2010 4:13pm

    Andrew Weaver

    206 posts

    The

    {cp_act_date format="{DATE_W3C}"}

    should format the date. Is it not doing so in your case?

    Andrew

  • #6 / Oct 04, 2010 4:19pm

    KMGDEV

    121 posts

    Dunno, I copied it straight out of your entry. All I get is a timestamp.

  • #7 / Oct 04, 2010 4:20pm

    Unifusion

    103 posts

    That last comment was me, I was accidentally logged in with my other account 😊

  • #8 / Oct 04, 2010 4:23pm

    Andrew Weaver

    206 posts

    Are you using the query module or the plugin I linked to?

    If you are using the query it should be outputting in the format: “2010-09-21T19:04:56+00:00”

    Andrew

  • #9 / Oct 04, 2010 4:35pm

    Unifusion

    103 posts

    I’m sorry Andrew, I wasn’t being specific enough.

    Yes, that query did indeed export the date & time correctly when the template was viewed on the web.

    Where I went wrong was when I went to install your plugin. It’s only EE2 compatible but I’m working with an EE1 site, so I downloaded CSVee instead. That’s where the problem lies, not in your helpful solution.

    Sorry about the confusion & thanks for the help!

  • #10 / Oct 05, 2010 2:49am

    John Henry Donovan

    12339 posts

    Thank you again Andrew 😊

    Unifusion, feel free to start a new thread if you have any more questions.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases