Sponsored Content
Full Discussion: Parse User Logon Count
Top Forums UNIX for Dummies Questions & Answers Parse User Logon Count Post 302852449 by Don Cragun on Wednesday 11th of September 2013 02:36:37 PM
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.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
ACCOUNTING(1)							      SMPPPD							     ACCOUNTING(1)

NAME
accounting - calculates statistics about your internet connections DESCRIPTION
accounting is a simple program to calculate statistics about your internet dial-up connections that are started and stopped by either ifup and ifdown or by a frontend to smpppd like cinternet , qinternet or kinternet. OPTIONS
These options are recognized by accounting. If a long option shows an argument as mandatory, then it is mandatory for the equivalent short option also. -l, --last=NUM Only consider the last NUM connections. -a, --after=DATE Only consider connections started after DATE. DATE is a date with optional time in ISO 8601 format, e.g. `2002-12-24 20:15:00'. Note that a date without time is treated as if the time is 00:00:00. Hence connections started on the specified date are consid- ered. -b, --before=DATE Only consider connections started before DATE. -u, --user=USER Only consider connections started by user USER. --this-year Only consider connections started this year. --last-year Only consider connections started last year. --this-month Only consider connections started this month. --last-month Only consider connections started last month. --this-week Only consider connections started this week. --last-week Only consider connections started last week. --today Only consider connections started today. --yesterday Only consider connections started yesterday. --per-year Show summaries on a per year basis. --per-month Show summaries on a per month basis. --per-week Show summaries on a per week basis. --per-day Show summaries on a per day basis. -c, --connections Only list the connections but do not show provider statistics. -p, --providers Do not list the connections only show the provider statistics. --connection-format=FORMAT The names of the columns to print in the connection list. The names must be separated by a comma. Known column names are time, type, provider, user, status, duration, rx, tx, rxtx, averx, avetx and averxtx. Each name may be appended by a colon and a number indicating the width for the column, e.g. provider:25. The value will not be truncated if the width is too small. --provider-format=FORMAT The names of the columns to print in the provider list equivalent to the --connection-format option. Known column names are provider, number, duration, rx, tx, rxtx, aveduration, averx, avetx and averxtx. --local Display all dates in local time. Also interpret dates on the command line in local time. This is the default. --utc Display all dates in UTC. Also interpret dates on the command line in UTC. --script[=STYLE] Format output for script. Known styles are c and sh. -f, --file=NAME Use a different file with accounting information. --report-errors Report erros in the accounting file. --version Show program version and exit. --help Show help information and exit. NOTES
All informations are only obtained through the accounting log. Hence the informations, esp. the data volume, of currently active connec- tions is not accurate. If you want the know the status of a connection, use ifstatus or a frontend to smpppd like cinternet , qinternet or kinternet instead. The user field is empty for connections started by a remote frontend of smpppd. BUGS
Not yet implemented for ISDN (ippp). FILES
/var/log/smpppd/accounting.log File containing accounting information. SEE ALSO
kinternet, qinternet, cinternet(1), smpppd(8), smpppd-ifcfg(8). AUTHOR
Arvin Schnell <arvin@suse.de> SuSE December 2002 ACCOUNTING(1)
All times are GMT -4. The time now is 09:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy