Sponsored Content
Top Forums Programming serializing logging output mult. proc. inst deamon Post 302101857 by matrixmadhan on Friday 5th of January 2007 03:09:17 AM
Old 01-05-2007
Quote:
How would you propose to achieve that?
Locking the log file- If that was the option for such an I/O intensive operation, that's not to be appreciated.

Because once I deliberately switched logfile locking from shared memory resource locking to a simple file locking method for threaded application, the performance drastically came down just because they have to wait for the logfile to be unlocked ( that was done as staling the process untill the file lock on the log file was released )

Since other constraints about having one more process or additional resource utilization was not mentioned, am suggesting this idea. (Not sure whether its creative or trustworthy Smilie )

for the logs from 'n' different processes to a single log file 'lf'
a) stamp the log messages ( precision to be decided based on the frequency in which log messages are dumped consecutively ) such that they are redirected to a temp_log_file 'temp_lf'
b) either you can have an another iterative process or standard utility to parse and feed the actual log file 'lf' from the temp file 'temp_lf'. That is the reason I had requested to stamp the log messages which would be easier while parsing.
c) once done periodically clean the 'temp_lf' file.
d) apart from erratic/strange behaviour I really dont see any situation/condition where you have to worry for a single byte loss Smilie

(Oops! Jim had already mentioned about time-stamping)
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Inst. Solaris10

I just download solaris 10, from sun.com, I have them ziped in my HD, How can I install them, so I can run solaris10, my present os is RH9; THANKS (5 Replies)
Discussion started by: mxlst14
5 Replies

2. UNIX for Advanced & Expert Users

logging ps output

i want to log the output of ps. i want to see the ps outpıt line by line as i see in the stdout but when i write it to a file it concatenates all lines do you have any suggestion? what i am using: echo `ps -ef -o cmd,cpu,pcpu,cputime,nswap`>>log.txt what i am getting: Mon Sep 11... (3 Replies)
Discussion started by: gfhgfnhhn
3 Replies

3. Shell Programming and Scripting

Redirection of output (for logging)

Hi, Currently I'm working on a lenghty script so I figured it would be useful to create a logfile so that output that is displayed on the users screen is also stored in the log file for later reference...... kinda like the whole point of a log file! Anyway, I was just wondering if there was an... (3 Replies)
Discussion started by: _Spare_Ribs_
3 Replies

4. Solaris

Logging commands and output

I'm looking for a CLI utility that will capture all the commands you type at the Solaris CLI (and their output) into a file. I'm sure it's called "scripter", but I can't find anything on a command called scripter. Does anyone know of a such a command? Your help will be greatly... (3 Replies)
Discussion started by: soliberus
3 Replies

5. UNIX for Dummies Questions & Answers

_/proc/stat vs /proc/uptime

Hi, I am trying to calculate the CPU Usage by getting the difference between the idle time reported by /proc/stat at 2 different intervals. Now the 4th entry in the first line of /proc/stat will give me the 'idle time'. But I also came across /proc/uptime that gives me 2 entries : 1st one as the... (0 Replies)
Discussion started by: coderd
0 Replies

6. UNIX for Dummies Questions & Answers

Logging Command Line and Output in Unix

Hi, This might be a bit stupid question, but what command to use to create like a session which logs the command line, and output on to the screen? Basically, a log to a file, where I can review what I had install, uninstall, etc. Thank you (4 Replies)
Discussion started by: kittoinc
4 Replies

7. UNIX for Advanced & Expert Users

Serializing script Failing for more commands

I have a reqirement to serialise various rsh scripts that hit my server from an external scheduler. No matter how many scripts come via rsh, only one should execute at a time and others should wait. I have made the scheduler make a request to my shell script with the command to be run as a... (4 Replies)
Discussion started by: nkamatam
4 Replies

8. Red Hat

Output of /proc/version

Hi, I am a newbie in Linux. Appended is the output of cat /proc/version and uname -a. # cat /proc/version Linux version 2.6.32.12-115.fc12.i686 (mockbuild@x86-03.phx2.fedoraproject.org) (gcc version 4.4.3 20100127 (Red Hat 4.4.3-4) (GCC) ) #1 SMP Fri Apr 30 20:34:53 UTC 2010 # uname -a... (7 Replies)
Discussion started by: Hari_Ganesh
7 Replies

9. Shell Programming and Scripting

how to convert string to an integer and how to do calculations like add.,sub.,mult. on it

How to convert string into an integer or number For example : % set tim = `date` % echo $tim Tue Feb 22 16:25:08 IST 2011 here How to increment time by 10 hrs like 16+10 , here 16 is a string in date cmd. .. how to convert 16 to an integer and added to a another nimber ? Thanks... (3 Replies)
Discussion started by: sbhamidi
3 Replies

10. Solaris

Logging the memory consumed by a process with c/C++ without using proc

I need to log the size of physical/virtual memory consumed by any given given process using c/c++ code running on solaris and aix without using the proc filesystem. Please advise. (1 Reply)
Discussion started by: Manisha Paul
1 Replies
CLOGIT(3)						     Common Library Functions							 CLOGIT(3)

NAME
Clogit - log server messages in local log or in system logger SYNOPSIS
#include "Clog.h" int Cinitlog (char *cmd, char *logfile) int Clogit (int level, char *func, char *msg, ...) int Cvlogit (int level, char *func, char *msg, va_list ap) DESCRIPTION
Cinitlog initializes the server logging routines. Clogit logs server messages in a local log or in the system logger. Cvlogit is the same as Clogit but takes a va_list instead of a variable number of arguments. cmd specifies a string to be prepended to the syslog messages. logfile specifies a path for the server log file. If set to syslog, the system logger will be used. By default, only messages with level at least as important as LOG_INFO will be logged. The level threshold can be changed with the environment variable LOG_PRIORITY. level is associated with the message. The possible values, in order of decreasing importance are: LOG_EMERG LOG_ALERT LOG_CRIT LOG_ERR LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG func is the name of the function that issues the message. msg is a format as in printf. RETURN VALUE
These routines return 0 if the operation was successful or -1 if the operation failed. In the latter case, serrno is set appropriately. ERRORS
EFAULT logfile is a NULL pointer. ENAMETOOLONG The length of logfile exceeds CA_MAXPATHLEN. LCG
$Date$ CLOGIT(3)
All times are GMT -4. The time now is 05:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy