Parse User Logon Count


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Parse User Logon Count
# 1  
Old 09-11-2013
Parse User Logon Count

Hey,

My access.log for one application is not rolled over.

I would like to get users count.

Right now I am doing
Code:
cat logon.list | grep 2013-09-11| |grep Succeeded | wc -l

Since the file doesnt rotate out I have to grep for new date/
I tried to specify DATE=date "+DATE: %Y-%m-%d" in a script but grep string isnt correctly done.

How to get awk to pick the latest data and grep and wc-l out latest user logons?

Thanks,

Last edited by vbe; 09-11-2013 at 10:08 AM.. Reason: code tags...
# 2  
Old 09-11-2013
Quote:
Originally Posted by brabored
Hey,

My access.log for one application is not rolled over.

I would like to get users count.

Right now I am doing
Code:
cat logon.list | grep 2013-09-11| |grep Succeeded | wc -l

Since the file doesnt rotate out I have to grep for new date/
I tried to specify DATE=date "+DATE: %Y-%m-%d" in a script but grep string isnt correctly done.

How to get awk to pick the latest data and grep and wc-l out latest user logons?

Thanks,
You are setting DATE to the string "date" (and probably getting an error message something like +DATE: %Y-%m-%d: not found).

Assuming that "Succeeded" follows the date in your log file, try:
Code:
DATE=$(date "+DATE: %Y-%m-%d")
grep -c "$DATE.*Succeeded" logon.list

Since you didn't show us any sample input nor expected output, I have no way to verify that this will do what you want. Note that the greps that are working for you above are not looking for DATE: before the 2013-09-11 that the expansion of your DATE variable will include.
# 3  
Old 09-13-2013
So the objective is not have to update the "date" - the command should use the system date to provide total count of users who "succeeded" in their logon attempt

Any other ideas, anyone?

---------- Post updated at 11:32 AM ---------- Previous update was at 11:20 AM ----------

Ended up using date=`date '+%Y-%m-%d'` as the variable and get the total count now.
Thanks for contributing!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find logon user based on executed script proc id

Hi, i have requirement to find logged in user based on process id. i have below scenario. 1. all my users will logon to unix box using ssh from windows system. 2. after successful logon they will sudo to common user. ex. sudo -su edadm lot of users are executing jobs from edadm user and... (2 Replies)
Discussion started by: tmalik79
2 Replies

2. Shell Programming and Scripting

Get user id count for a range

I have a file which has users having different values against them in second column. I want to set a range and get the count of users in that range. Suppose :- a 4 b 19 c 27 d 87 e 123 And I define the range like 1-20 , 20 -50 and so on..... Please assume the... (1 Reply)
Discussion started by: Sanjeev Yadav
1 Replies

3. Shell Programming and Scripting

Limit a user's login prompt upon logon

Hey Am new to scripting in aix 5.3 I need to write a script to limit a user's logon prompt to an interactive menu based upon logon and nothing else. Any ideas much appreciated. :wall: (4 Replies)
Discussion started by: mills
4 Replies

4. Shell Programming and Scripting

Parse large file on line count (random lines)

I have a file that needs to be parsed into multiple files every time there line contains a number 1. the problem i face is the lines are random and the file size is random. an example is that on line 4, 65, 187, 202 & 209 are number 1's so there has to be file breaks between all those to create 4... (6 Replies)
Discussion started by: darbs121
6 Replies

5. Solaris

Help a user logon in SUN SOLARIS 10 ?

I logon with root user, then ok, but as a user logon is not, it is the login window forever ah, wishes to receive help from members of the forum, thanks very much. (2 Replies)
Discussion started by: tampc
2 Replies

6. Shell Programming and Scripting

Parse file from remote server to calculate count of string existence in that file

Hi I need to parse the file of same name which exist on different servers and calculate the count of string existed in both files. Say a file abc.log exist on 2 servers. I want to search for string "test" on both files and calculate the total count of search string's existence. For... (6 Replies)
Discussion started by: poweroflinux
6 Replies

7. Solaris

Solaris 8 logon problem with normal user

Hello. I have problem in Solaris 8. I can logon cde with root there is no problem. When I logon with normal user I am recieving black screen after 10 15 second login screen (cde pasword screen) coming again. 1 years ago we resolved same problem. We found a file It must be run with admin... (1 Reply)
Discussion started by: FATIH1453
1 Replies

8. Solaris

user logon details

how can i identifying whose are logged in last few days,time and date also want. what i will do for get that information (2 Replies)
Discussion started by: sijocg
2 Replies

9. Shell Programming and Scripting

Parse and count lines

I have a data file in the following format (refer to input file) with multiple lines containing some information. I need an output file to loop thorough the input file with summarized information as seen below (refer to output file) ‘Date Time' and ‘Beta Id' input file values should be concatenated... (7 Replies)
Discussion started by: shekharaj
7 Replies

10. UNIX for Dummies Questions & Answers

Multiple user logon

I keep trying to use ssh shell to access my school's unix server from home and I get this error message: "This user id is logged on too many times. Please end some logins to reduce your total number of logins to no more than 1. Please do so in the next 1 minutes or you will be logged out... (3 Replies)
Discussion started by: hawkshot
3 Replies
Login or Register to Ask a Question