05-31-2012
grep log lines logged in 10 min
A log files has lines (1 line per each log for a majority; a few for 2 lines per each log)
PHP Code:
May 31 14:00:11 rtprodapp1 local2:notice sudo: jdoe : TTY=pts/0 ; PWD=/home/jdoe ; USER=root ; COMMAND=/usr/bin/su -
May 31 14:03:19 rtprodapp1 local2:notice sudo: jdoe : TTY=pts/0 ; PWD=/home/jdoe ; USER=root ; COMMAND=/usr/bin/su -
How do you grep the lines logged in 10 min?
Please advise.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a task where I need to code a shell script to extract a 10 min range (10 min from now until now) extract of a log file.
I taught I could simply use a command that would say something like Start=date - 10 min but I didn't find anything. Looks like the only solution would have to code a... (3 Replies)
Discussion started by: Browser_ice
3 Replies
2. Shell Programming and Scripting
Hi,
I have log file like this:
i want grep the log file without blank lines in column 4. So the file is become like this :
What is the command?
please help me. (1 Reply)
Discussion started by: justbow
1 Replies
3. Shell Programming and Scripting
I need help trying to grep for a error in log file for only last 15 min.
example
under /var/adm/messages i need to grep for "error 102" but only if it occured in last 15 mins?
Thanks (7 Replies)
Discussion started by: shehzad_m
7 Replies
4. Shell Programming and Scripting
For the first 4 users only that are currently logged in output their effective user id.
It's not important the order in which each logged in i just want to have the top 4.
Same question as here...... (0 Replies)
Discussion started by: whyatepies
0 Replies
5. Shell Programming and Scripting
Hi
i wrote script use it as watchdog ( i mean it check another program (pooya) whenever that was killed (closed or crashed) it run another script (pooya_start.sh) to start it,
this script work fine and do the job for me , i need help of an expert to tell me (exact command) how to change this... (8 Replies)
Discussion started by: pooyair
8 Replies
6. Shell Programming and Scripting
Hi guys!
I'm new to scripting and I need to write a script in awk.
Here is example of file on which I'm working
ATOM 4688 HG1 PRO A 322 18.080 59.680 137.020 1.00 0.00
ATOM 4689 HG2 PRO A 322 18.850 61.220 137.010 1.00 0.00
ATOM 4690 CD ... (18 Replies)
Discussion started by: grincz
18 Replies
7. Shell Programming and Scripting
I need to grep all lines for "yesterday" in /var/log/messages. Dates are in the format "YYYY-MM-DD". (5 Replies)
Discussion started by: Padmanabhan
5 Replies
8. Shell Programming and Scripting
I have a file with two ID columns followed by five columns of counts in fraction form. I'd like to print lines that have a count of at least 4 (so at least 4 in the numerator, e.g. 4/17) in at least one of the five columns.
Input file:
comp51820_c1_seq1 693 0/29 0/50 0/69 0/36 0/31... (6 Replies)
Discussion started by: pathunkathunk
6 Replies
9. Shell Programming and Scripting
You have a log file as attached in sample input with various operations and time taken by each of them. Write a script to find the min and max time taken for each operation. Sample output is attached.
Sample Input is given as below:
operation1,83621
operation2,72321
operation3,13288... (1 Reply)
Discussion started by: Chandan_Bose
1 Replies
10. UNIX for Beginners Questions & Answers
Hi guys,
Appreciate your help as I am stuck with searching the logs for last 30 minutes from the current time. Current time is time when you execute the script and it will search for <string> through the logs for last 30 minutes only and if <string> found then print those lines only.
The... (18 Replies)
Discussion started by: rockstar
18 Replies
LEARN ABOUT OSX
dscacheutil
dscacheutil(1) BSD General Commands Manual dscacheutil(1)
NAME
dscacheutil -- gather information, statistics and initiate queries to the Directory Service cache.
SYNOPSIS
dscacheutil -h
dscacheutil -q category [-a key value]
dscacheutil -cachedump [-buckets] [-entries [category]]
dscacheutil -configuration
dscacheutil -flushcache
dscacheutil -statistics
DESCRIPTION
dscacheutil does various operations against the Directory Service cache including gathering statistics, initiating lookups, inspection, cache
flush, etc. This tool replaces most of the functionality of the lookupd tool previously available in the OS.
FLAGS
A list of flags and their descriptions:
-h Lists the options for calling dscacheutil
-q category
Initiate a query using standard calls. These calls will either return results from the cache or go fetch live data and place them in
the cache. By default if no specific query is requested via -a then all results within that category will be returned.
-a key value
Optional flag to -q for a specific key with a value.
-cachedump
Dumps an overview of the cache by default. Additional flags will provide more detailed information.
-buckets
Used in conjunction with -cachedump to also print hash bucket usage of the current cache.
-entries [category]
Used in conjunction with -cachedump to dump detailed information about cache entries. An optional category can be supplied to only
see types of interest. Dumping 'host' entries can only be done by administrative users.
-configuration
Prints current configuration information, such as the search policy from Directory Service and cache parameters.
-flushcache
Flushes the entire cache. This should only be used in extreme cases. Validation information is used within the cache along with
other techniques to ensure the OS has valid information available to it.
-statistics
Prints statistics from the cache including an overview and detailed call statistics. Some calls are not cached but are derived from
other calls internally. Cache hits and cache misses may not always be equal to external calls. For example getaddrinfo is actually
a combination of gethostbyname with other calls internally to the cache to maximize cache hit rate.
Available categories and associated keys:
group name or gid
host name or ip_address (used for both IPv6 and IPv4)
mount name
protocol name or number
rpc name or number
service name or port
user name or uid
EXAMPLES
Lookup a user:
% dscacheutil -q user -a name jdoe
name: jdoe
password: ********
uid: 501
gid: 501
dir: /Users/jdoe
shell: /bin/csh
gecos: John Doe
Lookup all users:
% dscacheutil -q user
Dump cache overview:
% dscacheutil -cachedump
Dump cache details with user entries:
% dscacheutil -cachedump -entries user
SEE ALSO
DirectoryService(8), dsmemberutil(1)
Darwin Jan 14, 2007 Darwin