sort syslog messages


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sort syslog messages
# 1  
Old 08-10-2006
sort syslog messages

how can i sort the syslog message, so that the lastest time stamp show first , oldest show last.
# 2  
Old 08-11-2006
The syslog on most systems writes to a file, and since all events are written in the order in which they occurred, you will always get the latest messages at the end of the file.

You could use sort to get the file in the reverse order (the date/time at which the message was posted is always part of every entry).

--EDIT
Code:
sort -nr -k0 -k1 -k2 /var/adm/messages

Tested on Solaris 8.

Last edited by blowtorch; 08-11-2006 at 12:07 AM.. Reason: put in code
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Syslog duplicate messages

I've heard that syslog in Solaris10 doesn't repeat duplicate messages and displays "last message repeated n times." Is there a way to increase the time interval, so that more messages are recognized as duplicates? thanks. (0 Replies)
Discussion started by: orange47
0 Replies

2. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

Hi Experts, I have a filelist collected from another server , now want to sort the output using date/time stamp filed. - Filed 6, 7,8 are showing the date/time/stamp. Here is the input: #---------------------------------------------------------------------- -rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies

3. Shell Programming and Scripting

Help with sort word and general numeric sort at the same time

Input file: 100%ABC2 3.44E-12 USA A2M%H02579 0E0 UK 100%ABC2 5.34E-8 UK 100%ABC2 3.25E-12 USA A2M%H02579 5E-45 UK Output file: 100%ABC2 3.44E-12 USA 100%ABC2 3.25E-12 USA 100%ABC2 5.34E-8 UK A2M%H02579 0E0 UK A2M%H02579 5E-45 UK Code try: sort -k1,1 -g -k2 -r input.txt... (2 Replies)
Discussion started by: perl_beginner
2 Replies

4. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

5. Shell Programming and Scripting

How to Sort Floating Numbers Using the Sort Command?

Hi to all. I'm trying to sort this with the Unix command sort. user1:12345678:3.5:2.5:8:1:2:3 user2:12345679:4.5:3.5:8:1:3:2 user3:12345687:5.5:2.5:6:1:3:2 user4:12345670:5.5:2.5:5:3:2:1 user5:12345671:2.5:5.5:7:2:3:1 I need to get this: user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Discussion started by: daniel.gbaena
7 Replies

6. AIX

syslog messages

Hi Is there any setting in the syslog.conf that I can define a string to disable certain type of message that is generated in the message file for example I want to stop these type of messages getting generated. UnablAug 18 07:06:30 local1:warn|warning KCML: WARNING /usr/local/kcml/kcml... (3 Replies)
Discussion started by: antointoronto
3 Replies

7. Red Hat

syslog messages.

Good Day. Any idea on the messages log. it would be a great help to us. Upon checking the on the system logs, I found the following messages: EXT3-fs: INFO: recovery required on readonly filesystem. EXT3-fs: write access will be enabled during recovery. kjournald... (1 Reply)
Discussion started by: cabloy
1 Replies

8. HP-UX

Getting error messages in syslog in HP-UX

Hi, I'm using HP-UX 11.11 on HP9000/800 PA-RISC system.I am getting the below messages daily in /var/adm/syslog/syslog.log file.Can someone help me out in this regard, why I am getting this messages & how to resolve it. I am using SSH version(HP-UX Secure Shell-A.04.20.004) Messages: Nov 26... (2 Replies)
Discussion started by: Mike1234
2 Replies

9. Shell Programming and Scripting

Help with separating syslog messages.

Hello Guys... I am bit new to shell scripting and was looking for help !! I have got syslog data on a linux server recording log messages from a device. I need to seperate the data from log to file so that I can push it excell and get a report from that. Log is in the format below "... (2 Replies)
Discussion started by: raj_26apr
2 Replies

10. Solaris

syslog messages every minute

Hi If we have for example a disk that is experiencing problems, ie read errors etc, a message will get generated via syslog every one minute....I come in the morning to hundreds upon hundreds of the same message. Is there anyway to change this to say 5 minutes or maybe 10 mins etc so that it... (1 Reply)
Discussion started by: hcclnoodles
1 Replies
Login or Register to Ask a Question