Sponsored Content
Top Forums Shell Programming and Scripting Collect last 2 days data from /var/log/messages Post 302897526 by makauser on Monday 14th of April 2014 02:18:28 PM
Old 04-14-2014
I don't need last 2 days files.....actually i need last 2 days information from /var/log/messages

Sample Input of /var/log/messages

Apr 11 9:05:35 RH6 kernel: imklog 4.6.2, log source = /proc/kmsg started.
Apr 11 9:05:35 RH6 rsyslogd: [origin software="rsyslogd" swVersion="4.6.2" x-pid="1261" x-info="http://www.rsyslog.com"] (re)start
Apr 13 12:02:35 RH6 kernel: imklog 4.6.2, log source = /proc/kmsg started.
Apr 13 12:02:35 RH6 rsyslogd: [origin software="rsyslogd" swVersion="4.6.2" x-pid="1261" x-info="http://www.rsyslog.com"] (re)start
Apr 14 19:14:55 RH6 kernel: imklog 4.6.2, log source = /proc/kmsg started.
Apr 14 19:14:55 RH6 rsyslogd: [origin software="rsyslogd" swVersion="4.6.2" x-pid="1261" x-info="http://www.rsyslog.com"] (re)start

Sample Output for given input

Apr 13 12:02:35 RH6 kernel: imklog 4.6.2, log source = /proc/kmsg started.
Apr 13 12:02:35 RH6 rsyslogd: [origin software="rsyslogd" swVersion="4.6.2" x-pid="1261" x-info="http://www.rsyslog.com"] (re)start
Apr 14 19:14:55 RH6 kernel: imklog 4.6.2, log source = /proc/kmsg started.
Apr 14 19:14:55 RH6 rsyslogd: [origin software="rsyslogd" swVersion="4.6.2" x-pid="1261" x-info="http://www.rsyslog.com"] (re)start
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

/var/log/messages

Which programm, deamon or script is responsible for filling the file /var/log/messages ? (1 Reply)
Discussion started by: Cozmic
1 Replies

2. Solaris

diff b/w /var/log/syslog and /var/adm/messages

hi sirs can u tell the difference between /var/log/syslogs and /var/adm/messages in my working place i am having two servers. in one servers messages file is empty and syslog file is going on increasing.. and in another servers message file is going on increasing but syslog file is... (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

3. UNIX for Advanced & Expert Users

/var/adm/messages vs /var/log/messages

The /var/adm/messages in Solaris seem to log more system messages/errors compared to /var/log/messages in Linux. I checked the log level in Linux and they seem OK. Is there any other log file that contains the messages or is it just that Linux doesn't log great many things? (2 Replies)
Discussion started by: gomes1333
2 Replies

4. Solaris

Difference between /var/log/syslog and /var/adm/messages

Hi, Is the contents in /var/log/syslog and /var/adm/messages are same?? Regards (3 Replies)
Discussion started by: vks47
3 Replies

5. Shell Programming and Scripting

How can view log messages between two time frame from /var/log/message or any type of log files

How can view log messages between two time frame from /var/log/message or any type of log files. when logfiles are very big and especially many messages with in few minutes, I would like to display log messages between 5 minute interval. Could you pls give me the command? (1 Reply)
Discussion started by: johnveslin
1 Replies

6. UNIX for Dummies Questions & Answers

fprintd messages in /var/log/messages

Whenever a user uses su I get the following error messages in /var/log/messages: Nov 23 04:24:55 <REMOVED> abrt: saved core dump of pid 26141 (/usr/libexec/fprintd) to /var/spool/abrt/ccpp-1322018695-26141.new/coredump (753664 bytes) Nov 23 04:24:55 <REMOVED> abrtd: Directory... (3 Replies)
Discussion started by: JakesHat
3 Replies

7. Shell Programming and Scripting

Cleanup a log file data every 2 days

How do i cleanup a log file data every 2 days, I was using below command in a script to remove log file every 2 days, but looks like its not working as log file date and time gets updated every 5 mins. Is there a way ? find ./ \( -name . -o -prune \) -type f -mtime -2 -name... (9 Replies)
Discussion started by: aix_admin_007
9 Replies

8. SuSE

Some error messages in var/log/messages

How are you? SUSE V10 and 11. In /var/log/messages I see these lines in some servers. I'd like to know what causes these errors and how to fix them. Thank you, error: PAM: Authentication failure for root from XXXXXXXX Did not receive identification string from XXXXXXX Invalid user suse-gm... (2 Replies)
Discussion started by: JDBA
2 Replies

9. Shell Programming and Scripting

Log all the commands input by user at real time in /var/log/messages

Below is my script to log all the command input by any user to /var/log/messages. But I cant achieve the desired output that i want. PLease see below. function log2syslog { declare COMMAND COMMAND=$(fc -ln -0) logger -p local1.notice -t bash -i -- "$USER:$COMMAND" } trap... (12 Replies)
Discussion started by: invinzin21
12 Replies

10. Shell Programming and Scripting

Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog

I have been searching and reading about syslog. I would like to know how to Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog. tail -f /var/log/messages dblogger: msg_to_dbrow: no logtype using missing dblogger: msg_to_dbrow_str: val ==... (2 Replies)
Discussion started by: kenshinhimura
2 Replies
sysdiagnose(1)						    BSD General Commands Manual 					    sysdiagnose(1)

NAME
sysdiagnose -- gathers system-wide diagnostic information helpful in investigating system performance issues SYNOPSIS
sysdiagnose -h sysdiagnose [-f results_directory] [-A archive_name] [-V volume_path] [-n] [-k] [-F] [-S] [-u] [-Q] [-b] [-p] [-P] [-d] [-D] [-r] [-R] [process_name | pid] DESCRIPTION
The sysdiagnose tool gathers system diagnostic information helpful in investigating system performance issues. A great deal of information is harvested, spanning system state and configuration. The data is stored /var/tmp directory. sysdiagnose needs to be run as root. To cancel an in-flight sysdiagnose triggered via command line interface, press Ctrl-. sysdiagnose is automatically triggered when the following key chord is pressed: Control-Option-Command-Shift-Period. What sysdiagnose collects: o A spindump of the system o Several seconds of fs_usage ouput o Several seconds of top output o Data about kernel zones o Status of loaded kernel extensions o Resident memory usage of user processes o Recent system logs o A System Profiler report o Recent crash reports o Disk usage information o I/O Kit registry information o Network status o If a specific process is supplied as an argument: list of malloc-allocated buffers in the process's heap is collected o If a specific process is supplied as an argument: data about unreferenced malloc buffers in the process's memory is collected o If a specific process is supplied as an argument: data about the virtual memory regions allocated in the process OPTIONS
-h Display help. -v Enable verbose mode to display the container information as it executes. -f results_directory Specify the directory where the results will be stored. The default results directory is /var/tmp. -A archive_name Specify the name of the archive created in the results directory. -V volume_path Specify the root volume for sysdiagnose to run on. -n Do not tar the resulting sysdiagnose directory. -k Do not remove the temporary directory. -F Get feedback data. -S Disable streaming to tarball. -u Disable UI feedback. -Q Skip footprint. -b Do NOT show the resulting archive in a Finder window upon completion. -p Collect only time-sensitive data. Disregards previous -d or -r flags. -P Do not collect time-sensitive data. -d Collect only log data. Disregards previous -p or -r flags. -D Do not collect log data. -r Collect only log archive. Disregards previous -p or -d flags. -R Do not collect log archive. process_name | pid If a single process appears to be slowing down the system, passing in the process name or ID as the argument gathers additional process-specific diagnostic data. Specify only ONE process at a time -- specifying multiple processes is not supported. EXIT STATUS
sysdiagnose exits with status 0 if there were no internal errors encountered during the diagnostic, or >0 when an error unrelated to external state occurs or unusable input is provided by the user. OS X
January 24, 1984 OS X
All times are GMT -4. The time now is 02:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy