Solved

Logfile Problem

Posted on 2004-09-03
4
458 Views
Last Modified: 2013-12-15
Hi,

I run a games server on mandrake linux (mohaa) and it generates a log file which is written to /root/.mohaa/main/qconsole.log.

at 5am, I run a stats program that parses the log file and generates html output files that are published on the web.

Currently, the only way to reset that log after it has been parsed is to shutdown the games server and start it again, as this clears the log file. If I delete the logfile while the game server is running, it stops appending to the log file. if I run the following command:

echo "" > /root/.mohaa/main/qconsole.log

the file size remains the same, but the text is unreadable apart from the stuff that is appended to it afterwards.

My question is, how can I clear this logfile without restarting the server and without stopping the game server appending to it?

Many Thanks
0
Comment
Question by:vibale
4 Comments
 
LVL 18

Expert Comment

by:liddler
ID: 11971424
cat /dev/null >/root/.mohaa/main/qconsole.log
or maybe kill -1 on the servers pid
0
 

Author Comment

by:vibale
ID: 11971491
cat /dev/null >/root/.mohaa/main/qconsole.log does the same as the echo "" >/root/.mohaa/main/qconsole.log

kill -1 pid killed the game server!!
0
 
LVL 2

Accepted Solution

by:
kevincasey earned 250 total points
ID: 11973122
if you're trying to get daily log files, you might be able to use a program such as cronolog (http://cronolog.org/).  if your server supports logging to a named pipe, you can get a directory full of qconsoleYYYYMMDD.log files.
0
 
LVL 1

Expert Comment

by:HollyRidge
ID: 12044689
Most linux servers normally come with an application called logrotate. I would suggest setting it up to rotate the logs for your game server within it. The config file can normally be found at /etc/logrotate.conf. Hope that helps.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now