Solved

Logfile Problem

Posted on 2004-09-03
4
465 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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.

705 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