Tracking User logins

Need help with FileZilla Server? Something does not work as expected? In this forum you may find an answer.

Moderator: Project members

Post Reply
Message
Author
hkypuk6
500 Command not understood
Posts: 2
Joined: 2015-03-03 18:51
First name: Michael
Last name: Babb

Tracking User logins

#1 Post by hkypuk6 » 2015-03-03 19:09

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

User avatar
botg
Site Admin
Posts: 33233
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse
Contact:

Re: Tracking User logins

#2 Post by botg » 2015-03-03 19:19

Going through the log is the only way to do it right now.

hkypuk6
500 Command not understood
Posts: 2
Joined: 2015-03-03 18:51
First name: Michael
Last name: Babb

Re: Tracking User logins

#3 Post by hkypuk6 » 2015-03-03 19:23

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.

ltiwana-public
500 Command not understood
Posts: 1
Joined: 2020-01-28 18:49
First name: LT
Last name: Tiwana

Re: Tracking User logins

#4 Post by ltiwana-public » 2020-01-28 18:56

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

Post Reply