Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script to capture logs based on REQUEST iD Post 302949240 by tsingh on Wednesday 8th of July 2015 11:41:12 AM
Old 07-08-2015
Thanks CORONA,

to add to this, few more questions
Q1:How to capture from a different location where I am currently in
My Log file are in one location eg: Suppose the request id is printed in log file named as test_1.log and this is located in cd /servers/xxx/yyyy. and I am directory cd /tmp, so how to stay in cd /tmp and try to capture logs.
Q2: Where to create the executable script and the reply you posted what filename is it the filename of the outfile name? or filename i should use the file name from where i want to grab the request id?
Q3: Looking to execute the script from cd /tmp and get the output at same place in a form of log file which can be analyzed for results.

Thanks
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture lines based on keywords

Hello everyone, I am trying to write a script that will capture few lines from a text file based on 2 keywords in the first line and 1 keyword in the last one. It could also be based on the first line only + the folllowing 3 lines. Could some one help or give directions. Thanks. (4 Replies)
Discussion started by: nimo
4 Replies

2. Shell Programming and Scripting

how to create one newfile and wants include some lines based on user request

I have one request, First it has to create one file and in that file it has to include some lines based on user request. Suppose user requested 10, then script needs to add 10 lines like below QAEVO_A1|A1 QAEVO_A2|A2 QAEVO_A3|A3 QAEVO_A4|A4 QAEVO_A5|A5 QAEVO_A6|A6 QAEVO_A7|A7... (8 Replies)
Discussion started by: sridhusha
8 Replies

3. Programming

Creating a web based id request form

Please pardon my ignorance, but I need to create a web-based form which can be used to request access to the unix servers in our environment. It just needs to have input fields for basic info (name, dept., etc.), and perhaps a drop-down box with the names of the servers. The form will be submitted... (2 Replies)
Discussion started by: wjssj
2 Replies

4. Shell Programming and Scripting

How to capture exit code of child script and send it to parent script?

#!/usr/local/bin/bash set -vx /prod/HotelierLinks/palaceLink/bin/PalacefilesWait /prod/HotelierLinks/palaceLink/bin/prodEnvSetup 03212013 & if then echo "fatal error: Palace/HardRock failed!!!!" 1>&2 echo "Palace Failed" | mail -s "Link Failed at Palace/HardRock" -c... (1 Reply)
Discussion started by: aroragaurav.84
1 Replies

5. Shell Programming and Scripting

How to capture the exit code of a shell script in a perl script.?

hi, i want to pop up an alert box using perl script. my requirement is. i am using a html page which calls a perl script. this perl script calls a shell script.. after the shell script ends its execution, i am using exit 0 to terminate the shell script successfully and exit 1 to terminate the... (3 Replies)
Discussion started by: Little
3 Replies

6. UNIX for Dummies Questions & Answers

How to Capture Informatica Error logs?

HI Team , Is there a way to capture information logs ( session or workflow ) and grep only ERROR or FAIL messages and send to email distro using mailx or sendmail option. I have around 200 sessions running on daily basis and this script has to run every day , and capture only error... (0 Replies)
Discussion started by: Perlbaby
0 Replies

7. Solaris

Capture PRSTAT based on CPU usage percentage

Hi, Recently i have write a simple script to capture CPU high usage based on prstat but i found out that it did capture correctly. I need to capture the rows that contains CPU usage more than 3%. Below line which i thought will capture CPU usage based CPU column in prstat(9th parameter) which is... (3 Replies)
Discussion started by: tharmendran
3 Replies

8. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies

9. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies
Poet::Log(3pm)						User Contributed Perl Documentation					    Poet::Log(3pm)

NAME
Poet::Log -- Poet logging SYNOPSIS
# In a conf file... log: defaults: level: info output: poet.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L - %P%n" category: CHI: level: debug output: chi.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} %m - %P%n" MyApp::Foo: output: stdout # In a script... use Poet::Script qw($log); # In a module... use Poet qw($log); # In a component... my $log = $m->log; # For an arbitrary category... my $log = Poet::Log->get_logger(category => 'MyApp::Bar'); # then... $log->error("an error occurred"); $log->debugf("arguments are: %s", @_) if $log->is_debug(); DESCRIPTION
Poet uses Log::Any and Log::Log4perl for logging, with simplified configuration for the common case. Log::Any is a logging abstraction that allows CPAN modules to log without knowing about which logging framework is in use. It supports standard logging methods ("$log->debug", "$log->is_debug") along with sprintf variants ("$log->debugf"). Log4perl is a powerful logging package that provides just about any logging-related feature you'd want. One of its only drawbacks is its somewhat cumbersome configuration. So, we provide a way to configure Log4perl simply through Poet configuration if you just want common features. Note: Log4perl is not a strict dependency for Poet. Log messages will simply not get logged until you install it or until you modify logging for your app. CONFIGURATION
The configurations below can go in any Poet conf file, e.g. "local.cfg" or "global/log.cfg". Here's a simple configuration that caches everything to "logs/poet.log" at "info" level. This is also the default if no configuration is present. log: defaults: level: info output: poet.log layout: %d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L - %P%n Here's a more involved configuration that maintains the same default, but adds several categories that are logged differently: log: defaults: level: info output: poet.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L - %P%n" category: CHI: level: debug output: chi.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} %m - %P%n" MyApp::Foo: output: stdout For the default and for each category, you can specify three different settings: o level - one of the valid log4perl levels (fatal, error, warn, info, debug, trace) o output - can be a relative filename (which will be placed in the Poet log directory), an absolute filename, or the special names "stdout" or "stderr" o layout - a valid log4perl PatternLayout string. If a setting isn't defined for a specific category then it falls back to the default. In this example, "MyApp::Foo" will inherit the default level and layout. Notice that we use '::' instead of '.' to specify hierarchical category names, because '.' would interfere with Poet::Conf dot notation. Finally, if you must use a full Log4perl configuration file, you can specify it this way: log: log4perl_conf: /path/to/log4perl.conf USAGE
Obtaining log handle o In a script (log category will be 'main'): use Poet::Script qw($log); o In a module "MyApp::Foo" (log category will be 'MyApp::Foo'): use Poet qw($log); o In a component "/foo/bar" (log category will be 'Mason::Component::foo::bar'): my $log = $m->log; o Manually for an arbitrary log category: my $log = Poet::Log->get_logger(category => 'Some::Category'); # or my $log = MyApp::Log->get_logger(category => 'Some::Category'); Using log handle $log->error("an error occurred"); $log->debugf("arguments are: %s", @_) if $log->is_debug(); See "Log::Any|Log::Any" for more details. MODIFIABLE METHODS
These methods are not intended to be called externally, but may be useful to override or modify with method modifiers in subclasses. Their APIs will be kept as stable as possible. initialize_logging Called once when the Poet environment is initialized. By default, initializes log4perl with the results of "generate_log4perl_config" and then calls "Log::Any::Adapter->set('Log4perl')". You can modify this to initialize log4perl in your own way, or use a different Log::Any adapter, or use a completely different logging system. generate_log4perl_config Returns a log4perl config string based on Poet configuration. You can modify this to construct and return your own config. SEE ALSO
Poet AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-05 Poet::Log(3pm)
All times are GMT -4. The time now is 01:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy