Sponsored Content
Top Forums Shell Programming and Scripting Is there a BASH script allowing me to grep specifics from /var/log/messages? Post 302995010 by vgplayer54 on Thursday 30th of March 2017 03:21:08 PM
Old 03-30-2017
Quote:
Originally Posted by Don Cragun
I don't care whether or not you know awk (although I would hope that you are making an attempt to learn how to use it if you want to process the types of data you're asking us to help you learn how to handle). But, I do expect you to know be able to answer questions about your data and I expect you to be able to describe how you want to process your data.
  1. Given your data (which you provided in post #4 in this thread), please show us where the port number you want to use to select records is located within those records.
  2. If you want to select records based on chains, please explain how a chain is identified in your data.
  3. The code you showed us used case-insensitive searches, but there doesn't seem to be any inconsistency in case in your data. Do you need case-insensitive search capabiliities?
  4. When you pass search criteria to your script, do you expect the script to treat those criteria as regular expressions or as fixed strings?
I can almost write awk scripts in my sleep, but I can't write a script to process data in any language if I don't understand what it is that I'm trying to do.
Sure, thank you for your help.

1.The port numbers are located within the /var/log/messages divided by how the port was used (ie. DPT=80 for incoming HTTP traffic or SPT=143 for outgoing mail traffic) Using only those two prefixes should be fine...such as
Code:
*PT=$portnumber

and have the user enter the variable for the port number.
2.No need for this, /var/log/messages includes all chain traffic which is what I want. No need to divide them by chain.
3.Case insensitive capabilities would be a bonus if you can make it possible! But I can definitely live without it.
4. I'm going to say fixed strings here, I don't believe there's a need for the script to search using regular expressions.
 

10 More Discussions You Might Find Interesting

1. Solaris

diff b/w /var/log/syslog and /var/adm/messages

hi sirs can u tell the difference between /var/log/syslogs and /var/adm/messages in my working place i am having two servers. in one servers messages file is empty and syslog file is going on increasing.. and in another servers message file is going on increasing but syslog file is... (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

2. UNIX for Advanced & Expert Users

/var/adm/messages vs /var/log/messages

The /var/adm/messages in Solaris seem to log more system messages/errors compared to /var/log/messages in Linux. I checked the log level in Linux and they seem OK. Is there any other log file that contains the messages or is it just that Linux doesn't log great many things? (2 Replies)
Discussion started by: gomes1333
2 Replies

3. Solaris

Difference between /var/log/syslog and /var/adm/messages

Hi, Is the contents in /var/log/syslog and /var/adm/messages are same?? Regards (3 Replies)
Discussion started by: vks47
3 Replies

4. Shell Programming and Scripting

How can view log messages between two time frame from /var/log/message or any type of log files

How can view log messages between two time frame from /var/log/message or any type of log files. when logfiles are very big and especially many messages with in few minutes, I would like to display log messages between 5 minute interval. Could you pls give me the command? (1 Reply)
Discussion started by: johnveslin
1 Replies

5. UNIX for Dummies Questions & Answers

/etc/sudoers for allowing oracle user to /var/log/messages

So I want the DBA to access /var/log/messages and so I logged in as root and then edited the sudoers file as follows "oracle ALL= (root) /bin/view, /var/log/messages" However when I login as oracle and try "sudo more /var/log/messages" I get Sorry, user oracle is not allowed to... (1 Reply)
Discussion started by: gubbu
1 Replies

6. UNIX for Dummies Questions & Answers

fprintd messages in /var/log/messages

Whenever a user uses su I get the following error messages in /var/log/messages: Nov 23 04:24:55 <REMOVED> abrt: saved core dump of pid 26141 (/usr/libexec/fprintd) to /var/spool/abrt/ccpp-1322018695-26141.new/coredump (753664 bytes) Nov 23 04:24:55 <REMOVED> abrtd: Directory... (3 Replies)
Discussion started by: JakesHat
3 Replies

7. Shell Programming and Scripting

Script to monitor /var/log/messages

Hello All, I want to write a script to monitor my product logs from /var/log/messages and send notifications without using "tail -f" command.Please suggest alternatives and any other tools for monitoring and alerting. Thank You (1 Reply)
Discussion started by: Cva2568
1 Replies

8. Shell Programming and Scripting

Log all the commands input by user at real time in /var/log/messages

Below is my script to log all the command input by any user to /var/log/messages. But I cant achieve the desired output that i want. PLease see below. function log2syslog { declare COMMAND COMMAND=$(fc -ln -0) logger -p local1.notice -t bash -i -- "$USER:$COMMAND" } trap... (12 Replies)
Discussion started by: invinzin21
12 Replies

9. Shell Programming and Scripting

Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog

I have been searching and reading about syslog. I would like to know how to Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog. tail -f /var/log/messages dblogger: msg_to_dbrow: no logtype using missing dblogger: msg_to_dbrow_str: val ==... (2 Replies)
Discussion started by: kenshinhimura
2 Replies

10. Shell Programming and Scripting

[bash] script is filling up my /var/log

I am trying to create a script that checks if my VPN connection is up and running... Everything seems to work as except but for some reason, the script fills up my /var/log/auth.log with the below information Dec 13 01:07:44 debian sudo: soichiro : TTY=pts/0 ; PWD=/home/soichiro/Desktop ;... (5 Replies)
Discussion started by: soichiro
5 Replies
CAPISUITE.CONF(5)														 CAPISUITE.CONF(5)

NAME
capisuite.conf - configuration of the CapiSuite daemon DESCRIPTION
The options for the CapiSuite daemon are configured here. They will be presented in brief here - for further details please refer to the comments in the configuration file itself. OPTIONS
incoming_script="/path/to/incoming.py" This option tells CapiSuite which script should be executed at incoming calls. Only change this if you want to use your own script. idle_script="/path/to/idle.py" This option reflects the path and name of the idle script. This script is called in regular intervalls to check if any outgoing call should be done. As above, the default should be ok if you don't use your own script. idle_script_interval="30" Here you can define how often the idle script should be executed. The number given is the interval between subsequent invocations in seconds. Lesser numbers give you quicker response to queued jobs but also a higher system load. The default should be ok in most cases. log_file="/path/to/capisuite.log" This file will be used for all "normal" messages printed byCapiSuite telling you what it does. Error messages are written to a spe- cial log (see below). log_level="1" You can define how detailled the log output of CapiSuite will be. The default will give you some informational messages for each incoming and outgoing call and should be enough for normal use. I would recommend to only increase it if you encounter some prob- lems. Logs of higher level are mainly intended for developers, so just use them if you want to report a problem or have some know-how of the CAPI interface and the internals of CapiSuite. log_error="/path/to/capisuite.error" All errors which CapiSuite detects internally and in your scripts will end up here. They are written to an extra file so that they don't get lost in the normal log. Please check this log regularly for any messages - especially when you encounter problems. Please report all messages you don't understand and which aren't caused by your own script-modifications to the CapiSuite team. DDI_length="0" When your ISDN card is connected to an ISDN interface in PtP mode, i.e. if you use DDI which, in understandable words mean you have only one ISDN phone number and can define your own extensions as you like, you have to set the length of your extension numbers here. In Germany, PtP mode is called "Anlagenanschluss". Let's say you use 1234-000 till 1234-999, then your DDI_length would be 3. If you set this to 0, DDI/PtP is disabled. If you're not sure what all this should mean, then chances are high you don't use DDI and can leave this option as it is. DDI_base_length="0" This option is only used when DDI_length is not 0. This is the length of your base number - in the example above it would be 4. DDI_stop_numbers="" If you usually use extension numbers of a specified length, but also want to use some shorter ones (e.g. the "-0" extension for you switchboard), then you can list these shorter extensions here, separated by commas. SEE ALSO
capisuite(8), fax.conf(5), answering_machine.conf(5), capisuitefax(1) AUTHOR
Gernot Hillier <gernot@hillier.de>. CAPISUITE.CONF(5)
All times are GMT -4. The time now is 09:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy