LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Clearing the var/log/adm/messages? (https://www.linuxquestions.org/questions/solaris-opensolaris-20/clearing-the-var-log-adm-messages-431717/)

as400 04-04-2006 03:42 PM

Clearing the var/log/adm/messages?
 
I just checked my var/log/adm/messages and its becoming very full..How can I clear those messages so they will not take any space up?

thanks

jlliagre 04-04-2006 04:05 PM

Code:

$ ls -l /var/log/adm/messages
/var/log/adm/messages: No such file or directory

Can you clarify about which files are growing ?

as400 04-04-2006 07:59 PM

Im sorry..its

/var/adm/messages

AbrahamJose 04-05-2006 08:14 AM

Error files
 
It seems they are readable log files.
see ls -al messages*
View them and delete the old ones, if u don't want them.

as400 04-05-2006 09:31 AM

# ls -al messages
messages: No such file or directory


I dont get it...Can you explain or post a command on how to remove all of those messages and let the logs start all over again? Thanks

Or...can I just logon as root and then highlight the ones that I dont need and then just hit the backspace button? Please explain..

Blinker_Fluid 04-05-2006 11:00 AM

What version of solaris are you using?

If it's 9 or higher you can use logadm to manage the logs. I believe it is a root cron job by default.

If you just want to delete the logs cat /dev/null > /var/adm/messages .

AbrahamJose 04-05-2006 12:58 PM

messages*
 
Dear as400
ls -al messages* (Note the '*')

Also see man syslogd

as400 04-05-2006 01:04 PM

# Apr 5 11:02:45 unknown su: 'su root' succeeded for vinand on /dev/pts/4
ls -al messages*
messages*: No such file or directory


I tried that too WITH the * before also....

I just want to clear all the logs to prevent them from taking up disk space. And then I want them to restart again...

Thats all.

AbrahamJose 04-05-2006 01:12 PM

Sorry
 
Im sorry..its

ls -al /var/adm/messages*

In my system I have many files.
messages (this is latest, So I can remove the remaining below)
messages.0
messages.1 etc

Plus u can
ls /etc/syslog.conf
If it exists do the following
>/var/adm/messages
syslogd -f /etc/syslog.conf


Now u see ls -al /var/adm/messages*

as400 04-05-2006 04:54 PM

$ ls -al /var/adm/messages*
-rw-r--r-- 1 root root 10586 Apr 5 14:03 /var/adm/messages
-rw-r--r-- 1 root root 2133982 Apr 5 10:08 /var/adm/messages.0


OK..All I want is to clear all the messages...And i wanted to start from the recent date.

I dont understand the last command..

what does this do???
Code:

>/var/adm/messages
syslogd -f /etc/syslog.conf

Your posting commands that I dont know what there are without you explaining them is no help to me...

Blinker_Fluid 04-05-2006 05:26 PM

Maybe I'm not understanding what you are attempting to do...

If all you want to do is delete the old messages then
rm /var/adm/messages*

If you don't understand that please say so.
From your ls output it appears that you have some log rotation going so the files will regenerate over time.

apt-get-dude 04-05-2006 07:39 PM

man logadm

pk21 04-10-2006 09:15 PM

Quote:

Originally Posted by Blinker_Fluid
If all you want to do is delete the old messages then
rm /var/adm/messages*

Don't think rm is the right option. That way filedescriptors will stay open to the deleted file, right?

I always just use:

> /var/adm/messages

This will clear the log and you don't need to restart anything.

as400 04-11-2006 11:01 AM

Is it like this:??

> /var/adm/messages

and thats it???

what does the " > " mean?

pk21 04-11-2006 12:51 PM

Thats it ;)

The > puts everything in front of the > in the file. Like if you would do: echo test > /var/adm/messages it would overwrite your file with only the word test

With two > you will add text to the end of the file, for example: echo test >> /var/adm/messages would append the word test to the file.


All times are GMT -5. The time now is 09:23 AM.