cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1686
Views
0
Helpful
1
Replies

ParStream log file rotate

kpurches
Cisco Employee
Cisco Employee

ParStream log file rotate
20181107 kpurches@cisco.com
also at: TechZone

Problem

ParStream log files grow forever until out of disk space
Applies to all ParStream (current) v6.0.1 and earlier (Kinetic EFM v1.6)

Solution

Use nohup and logrotate together.

First, use "nohup" to start the ParStream service and redirect the logging output to the STDIN of CAT instead of to the (default) I/O layer.

I start the ParStream like this instead:

 

su efmuser
cd /opt/cisco/kinetic/ParStream-Data
nohup /opt/cisco/kinetic/parstream/bin/parstream-server ps1 2>&1 </dev/null | cat >> /var/log/parstream/server.log &

 

Change these parameters for your environment, for this example,
ParStream is executed with the service account "efmuser"
the /conf directory with the parstream.ini file is located in /opt/cisco/kinetic/ParStream-Data/conf
the database is named ps1
and the log file is written to /var/log/parstream/server.log

Next, set up the Linux logrotate utility to manage the ParStream log files. I named the file "kinetic_efm_parstream".
Change this file to suit your environment then copy it to your ParStream node - place your logrotate script file in the directory “/etc/logrotate.d”. You should change the user and group on the first line, the example below uses "efmuser isu.users". In addition, you may have different retention needs, but the example below will compress logfiles that grow beyond 50MB (size) and keep the last 10 compressed files (rotate).

Logrotate example:

 

/var/log/parstream/*.log {
su efmuser isu.users
daily
size 50M
copytruncate
compress
rotate 10
missingok
}


note:
if this file is not owned by root after you copy it, you could change ownership like this:
chown root:root /etc/logrotate.d/kinetic_efm_parstream

nohup is required here because logrotate cannot make the ParStream process release the file it is logging to. Since we want to keep ParStream database service running while logrotate cycles the log files, we need to change the way we start ParStream. With this nohup command line, ParStream will send the logging output to the STDIN of cat instead of the I/O layer, which instead will relay the log file messages to the I/O layer. Logrotate can rotate the log from cat without interrupting the ParStream logging process.

 

 

 

 

#end

1 Reply 1

a.veneziano
Level 1
Level 1
Thank you so much.
Very useful.

Cheers :-)