Sponsored Content
Top Forums Shell Programming and Scripting prepend timestamp to continiously updating log file Post 302719991 by Corona688 on Tuesday 23rd of October 2012 11:28:06 AM
Old 10-23-2012
You don't... I can't think of an effective way to do this which doesn't involve fixing the application to do what you want in the first place.

If you must 'intercept' the log, make a new log, don't keep editing the old one in place. How many thousands of times will the application be killed to do it your way?

Code:
tail -f logfile | while read LINE
do
        echo $(date) "$LINE"
done > newlogfile

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Spooling a log file with timestamp

Hi From shell script i am invoking sqlplus to connect to oracle database and then i spool a csv file as with output. What i want to do is to change the file name with timestamp on it so after spooling finish shell script change file name with time stamp. can someone help me to do that . Thanks... (2 Replies)
Discussion started by: ukadmin
2 Replies

2. Shell Programming and Scripting

awk updating one file with another, comparing, updating

Hello, I read and search through this wonderful forum and tried different approaches but it seems I lack some knowledge and neurones ^^ Here is what I'm trying to achieve : file1: test filea 3495; test fileb 4578; test filec 7689; test filey 9978; test filez 12300; file2: test filea... (11 Replies)
Discussion started by: mecano
11 Replies

3. UNIX for Dummies Questions & Answers

prepend columns to a file

I have two files. File 'a' has contents: 1|1 2|2 3|3 4|4 and file 'b' has contents: abc|def hij|klm nop|qrs tuv|wxy I would like to prepend file 'a' to file 'b' (with pipe) such that the contents of 'b' will be: 1|1|abc|def 2|2|hij|klm 3|3|nop|qrs 4|4|tuv|wxy (3 Replies)
Discussion started by: ChicagoBlues
3 Replies

4. Shell Programming and Scripting

concatenate log file lines up to timestamp

Hi, Using sed awk or perl I am trying to do something similar to https://www.unix.com/shell-programming-scripting/105887-sed-awk-concatenate-lines-until-blank-line-2.html but my requirement is slightly different. What I am trying to accomplish is to reformat a logfile such that all lines... (4 Replies)
Discussion started by: AlanC
4 Replies

5. Shell Programming and Scripting

How to search backwards in a log file by timestamp of entries?

Hello. I'm not nearly good enough with awk/perl to create the logfile scraping script that my boss is insisting we need immediately. Here is a brief 3-line excerpt from the access.log file in question (actual URL domain changed to 'aaa.com'): 209.253.130.36 - - "GET... (2 Replies)
Discussion started by: kevinmccallum
2 Replies

6. Shell Programming and Scripting

Delete log file entries based on the Date/Timestamp within log file

If a log file is in the following format 28-Jul-10 ::: Log message 28-Jul-10 ::: Log message 29-Jul-10 ::: Log message 30-Jul-10 ::: Log message 31-Jul-10 ::: Log message 31-Jul-10 ::: Log message 1-Aug-10 ::: Log message 1-Aug-10 ::: Log message 2-Aug-10 ::: Log message 2-Aug-10 :::... (3 Replies)
Discussion started by: vikram3.r
3 Replies

7. Shell Programming and Scripting

Continiously monitor the log file

Hi Friends, I am trying to write a script which continiously monitor one specific error message from a log file. This script should continiously monitor the file for the error and send out the email when detect the error message. I tried the below command but fails. Please help me. tail -f... (4 Replies)
Discussion started by: arumon
4 Replies

8. Shell Programming and Scripting

Prepend TimeStamp to STDERR & STDOUT to a file

Currently I am redirecting STDERR and STDOUT to a log file by doing the following { My KSH script contents } 2>&1 | $DEBUGLOG Problem is the STDERR & STDOUT do not have any date/time associated. I want this to be something that i can embed into a script opposed to an argument I use... (4 Replies)
Discussion started by: nitrobass24
4 Replies

9. Shell Programming and Scripting

Need to get all the records from a log file greater than timestamp supplied.

I have a log file which has records with hung thread information/error I need to find out hung thread from log file greater than timestamp supplied. 00000026 ThreadMonitor W WSVR0605W: Thread "WebContainer : 1" (00000027) has been active for 701879 milliseconds and may be hung. There is/are... (6 Replies)
Discussion started by: megh
6 Replies

10. Shell Programming and Scripting

Log file is not updating when I run shell scripts scheduled thru crontab

Hi Forum, Good Day! I have created an empty html file wtih permissoin 777 created shell script(with permission 777) , code is below. #=======================start============== . /data09/oracle/apps_st/appl/D_oraapp095.env rm -rf /home/mnp/Test_log.txt echo... (1 Reply)
Discussion started by: kartheekbk
1 Replies
TWISTD(1)																 TWISTD(1)

NAME
twistd - run Twisted applications (TACs, TAPs) SYNOPSIS
twistd [options] DESCRIPTION
Read a twisted.application.service.Application out of a file and run it. OPTIONS
-n, --nodaemon Don't daemonize (stay in foreground). -q, --quiet No-op for backwards compatibility. -p, --profile <profile output> Run the application under the profiler, dumping results to the specified file. --profiler <profiler name> Specify the profiler to use. Defaults to the 'hotshot' profiler. --savestats Save the Stats object rather than the text output of the profiler. -b, --debug Run the application in the Python Debugger (implies --nodaemon option). Sending a SIGINT or SIGUSR2 signal to the process will drop it into the debugger. -e, --encrypted <file> The specified tap/aos file is encrypted. --euid Set only effective user-id rather than real user-id. This option has no effect unless the server is running as root, in which case it means not to shed all privileges after binding ports, retaining the option to regain privileges in cases such as spawning pro- cesses. Use with caution. -o, --no_save Do not save shutdown state. --originalname Behave as though the specified Application has no process name set, and run with the standard process name (the Python binary in most cases). -l, --logfile <logfile> Log to a specified file, - for stdout (default: twistd.log). The log file will be rotated on SIGUSR1. -l, --logger <fully qualified python name> A fully-qualified name to a log observer factory to use for the initial log observer. Takes precedence over --logfile and --syslog. --pidfile <pidfile> Save pid in specified file (default: twistd.pid). --chroot <directory> Chroot to a supplied directory before running (default: don't chroot). Chrooting is done before changing the current directory. -d, --rundir <directory> Change to a supplied directory before running (default: .). -u, --uid <uid> The uid to run as (default: don't change). -g, --gid <gid> The gid to run as (default: don't change). --umask <mask> The (octal) file creation mask to apply. (default: 0077 for daemons, no change otherwise). -r, --reactor <reactor> Choose which reactor to use. See --help-reactors for a list of possibilities. --help-reactors List the names of possibly available reactors. --spew Write an extremely verbose log of everything that happens. Useful for debugging freezes or locks in complex code. -f, --file <tap file> Read the given .tap file (default: twistd.tap). -s, --source <tas file> Load an Application from the given .tas (AOT Python source) file. -y, --python <python file> Use the variable "application" from the given Python file. This option overrides -f. This option implies --no_save. --syslog Log to syslog instead of a file. --version Print version information and exit. --prefix <prefix> Use the specified prefix when logging to logfile. Default is "twisted". Note that if twistd is run as root, the working directory is not searched for Python modules. SIGNALS
A running twistd accepts SIGINT for a clean shutdown and SIGUSR1 to rotate log files. AUTHOR
Written by Moshe Zadka, based on twistd's help messages. REPORTING BUGS
To report a bug, visit http://twistedmatrix.com/trac/wiki/TwistedDevelopment#DevelopmentProcess COPYRIGHT
Copyright (C) 2001-2011 Twisted Matrix Laboratories. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. Dec 2011 TWISTD(1)
All times are GMT -4. The time now is 05:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy