LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 06-10-2008, 09:25 AM   #1
manoj.linux
Member
 
Registered: Aug 2007
Posts: 284

Rep: Reputation: 17
Question last command


Hi,

I am getting login attempts of users for 15 days only using last command , is there any way I want login attempts of 2 months?


Regards,

Manoj
 
Old 06-10-2008, 09:44 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
The last command shows the last login attempts based on the content of /var/log/wtmp. If the file is log rotated, you can select an older file using the -f option. How many wtmp files are kept on your system, depends on the logrotate rules.
 
Old 06-12-2008, 12:07 AM   #3
manoj.linux
Member
 
Registered: Aug 2007
Posts: 284

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by colucix View Post
The last command shows the last login attempts based on the content of /var/log/wtmp. If the file is log rotated, you can select an older file using the -f option. How many wtmp files are kept on your system, depends on the logrotate rules.

Thanks for quick reply, But can we increase the time limit for example if it is showing 15 days data can we increase upto 1 Month.


Regards,

Manoj
 
Old 06-12-2008, 02:22 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
It still depends on the content of the /var/log/wtmp file. You can reduce the number of shown entries using the -n option, but if the data are splitted in different files you have to use the -f option. You can read from multiple files with one command
Code:
last -f /var/log/wtmp -f /var/log/wtmp.1
but if you want to extract a specific period of time, for example exactly one month before, you have to parse the output of the above through scripting.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Translating windows pscp command to linux scp command help robward Linux - General 2 01-17-2008 06:02 AM
startx command in FC7 reverts me back to the command prompt sriram87 Linux - Newbie 5 01-03-2008 11:18 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 07:14 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 12:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration