The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I limit the log file size?

Highlighted
Kevin Bob
Occasional Contributor

How do I limit the log file size?

I would like to limit the log file size to say 5 MB, how do i do that in SD 4.5?
Is there way in SD to define a threshold for the log size? and what is the format of the logfile?.

Im looking setting this for log files of SD Appserver.

Thanks in advance.

Regards
Kevin
6 REPLIES
Mark O'Loughlin
Honored Contributor

Re: How do I limit the log file size?

Hi,

there is no out of bax functionality that lets you do this in OVSD.

However you can script a command line .bat file to do the following and schedule it using windows scheduler

Stop the ovsd service
Rename the log file to the current date and time
Start the ovsd service again
JaS_4
Honored Contributor

Re: How do I limit the log file size?

See http://openview.hp.com/ecare/getsupportdoc?docid=OV-EN008040 for pointers.

In order to get a 'new' (empty) LOGSERVER.TXT do the following:

1. Stop the Service Desk service.
2. Rename (logically delete) LOGSERVER.TXT
(to something like LOGSERVER.OLD).
3. Start the Service Desk service. This will create a new LOGSERVER.TXT.

To stop the service via the command line use:
net stop "hp OpenView service desk 4.5 server"
The dos rename command syntax is as follows: RENAME
[drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.
Kevin Bob
Occasional Contributor

Re: How do I limit the log file size?

Thanks Mark & Jas,

I would like to know the format of the logfile (for logserver in particular).

Also we dont want to restart the service. Is it possible to achieve this task?
Say if the logserver exceeds 5MB, it has to create a new file logserver1.txt, the latest contents will have to remain in the logserver itself.Can we have a script to do this task?

Thanks in advance

Regards
Kevin
Ganesha Sridhar
Esteemed Contributor

Re: How do I limit the log file size?

Hello Kevin,

The following script can be used to archive the OVSD log file:

#!/usr/bin/ksh

# Get the size of the log file
OUTPUT=`wc -c /opt/OV/sd/server/log/logserver.txt`
FILE_SIZE=`echo $OUTPUT | awk '{print $1}'`

# Compare the size and archive it
if [[ $FILE_SIZE -gt 5000000 ]]
then
cp /opt/OV/sd/server/log/logserver.txt /opt/OV/sd/server/log/logserver.txt.1
cat /dev/null > /opt/OV/sd/server/log/logserver.txt
fi



The script can be extended to keep say 10 log files and error handling can be done in the script. The above sample is just snippet and can be called from cron job.

It worked for me.

Regards
Ganesha Sridhara
Craig R Taylor
Collector

Re: How do I limit the log file size?

I think if you copy the original file logserver.txt to a backup you can then copy a blank file over the original thus making it so you don't have stop/start the server.

I haven't implemented this in our production environment yet but basically this batch file creates a new directory based on today's today, copies all the logs into that directory and then blanks the logserver.txt file.

md %date:~-4,4%\%date:~-10,2%\%date:~-7,2%
copy *.txt %date:~-4,4%\%date:~-10,2%\%date:~-7,2%
copy blank.txt logserver.txt
You can observe a lot just by watching. - YOGI BERRA
chinna!
Collector

Re: How do I limit the log file size?

Hi,

You can mange the logfile by disabling email debugger & Rule. if you check this two option it causes to increse log file size very fast.

I hope this will help you
//Add this to "OnDomLoad" event