Page 1 of 1

Tracking User logins

Posted: 2015-03-03 19:09
by hkypuk6
Other than going thru the log file for each day, is there a way the I can find out which "users" have logged into the FTP Server, and when the last time was that they logged in? I have a lot of users and some I'm finding have never logged in or very rarely log into the server. I would like to remove those users who have never logged in. It would be nice to show last logged in date within the window where you setup each user.


mike

Re: Tracking User logins

Posted: 2015-03-03 19:19
by botg
Going through the log is the only way to do it right now.

Re: Tracking User logins

Posted: 2015-03-03 19:23
by hkypuk6
botg wrote:Going through the log is the only way to do it right now.
Thanks. Hopefully this is something that others have interest in and can be added as a new feature down the road.

Re: Tracking User logins

Posted: 2020-01-28 18:56
by ltiwana-public
I was in the same situation where we need to find active users and migrate them to new servers. So I created a PowerShell script to break down the log files and provide me with username and timestamp.


if you have logging enabled then something like this would work through PowerShell:

Code: Select all

$FileZillaLogs = $null
$FileZillaUsers = @()

## Use this line to only look at one log file
$FileZillaLogs = Get-Content  "C:\Program Files (x86)\FileZilla Server\Logs\fzs-2020-01-13.log"

## OR

## Uncomment this line to look at all the files in log folder
#$FileZillaLogs = Get-Content  "C:\Program Files (x86)\FileZilla Server\Logs\*.log"

foreach ($Line in $FileZillaLogs) {
    
    $Date = $Null
    $Username = $Null
    
    if ($Line -match '> USER') {
    
        $Line -match "\d{2}\/\d{2}\/\d{4} \d{1,2}:\d{1,2}:\d{1,2} (A|P)M" | Out-Null
        $Date = $Matches[0]
        $Username = ($Line -split "USER ")[1].trim()
        
        $FileZillaUsers += [PSCustomObject]@{
            Date = $Date
            Username = $Username
            
        }
        
    }
} 

# Display the results
$FileZillaUsers | FT -autosize

# Export the infomraton to a csv file
$FileZillaUsers | Export-Csv FileZillaUsers.csv -NoTypeInformation