LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2011, 11:15 AM   #1
morph3u5
LQ Newbie
 
Registered: Feb 2011
Posts: 4

Rep: Reputation: 0
Lightbulb [Help] Script two look into 2 different logs and action


Hi guys

I need someone who can help me in this matter

I have a server with logs running. People connect to server. This server is running the same application as a failover just in case it stops. I have a doubt that some clients are connecting from different places as the nodeID is changed

SO I need to make a script which reads both logs that are called server1.log and server2.log and where it finds a nodeID which does not match in both logs it action with fail2ban

I don't know whether this can be done directly via fail2ban since it is the program which I know that reads between logs but as far as I know it cannot match data with another log

This is an Example:

Code:
Log 1

03:00:08.905 client qwe696s@894b226f7846d9df, running version 2.1

Log 2
03:00:08.905 client qwe696s@894b226f7846d9dd, running version 2.1
Quote:
qwe696s is the username
894b226f7846d9df is the NODEID
AS you can see from the logs nodeid is different

Would really appreciate your help in this matter

Running: Debian 5.0
 
Old 02-05-2011, 07:22 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
In essence this looks like fixing symptoms instead of addressing the cause to me. Wouldn't the latter be more efficient? What application are we talking about? Why does the application go down in the first place? Does it hang? Does debug logging show clues? Or it it just buggy? How will you know it's down? Could monitoring (Monit?) process details or an URI help in restarting the application?..
 
Old 02-06-2011, 11:56 AM   #3
morph3u5
LQ Newbie
 
Registered: Feb 2011
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
In essence this looks like fixing symptoms instead of addressing the cause to me. Wouldn't the latter be more efficient? What application are we talking about? Why does the application go down in the first place? Does it hang? Does debug logging show clues? Or it it just buggy? How will you know it's down? Could monitoring (Monit?) process details or an URI help in restarting the application?..
This application is tailored named MGfusion. I have not said that it hangs. It works perfect. What I need is a script that will run at a cron to ban users who have different node ID. That simple. I would appreciate if someone can help with a script
 
Old 02-07-2011, 04:30 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
Quote:
Originally Posted by morph3u5 View Post
I have not said that it hangs. It works perfect.
Ah, so that's why you wrote:
Quote:
Originally Posted by morph3u5 View Post
server is running the same application as a failover just in case it stops.
*shrug*


Quote:
Originally Posted by morph3u5 View Post
What I need is a script that will run at a cron to ban users who have different node ID. That simple. I would appreciate if someone can help with a script
I'm sure you need it but what have you tried? Post any commands or (pseudo)code you have else have a look at some Bash scripting guides like http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html , http://www.tldp.org/LDP/Bash-Beginne...tml/index.html and the http://www.tldp.org/LDP/abs/html/ . If log file line items have fixed positions then with 'cut' or 'awk' you can print a field (say 'tailf logfilename 2>/dev/null|awk '{print $3}' 2>/dev/null;'), catch output in a variable, split user name and node, grep the other log for the user name and compare the node. Yes, it's that simple.
 
Old 02-07-2011, 07:00 AM   #5
morph3u5
LQ Newbie
 
Registered: Feb 2011
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Ah, so that's why you wrote:

*shrug*



I'm sure you need it but what have you tried? Post any commands or (pseudo)code you have else have a look at some Bash scripting guides like http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html , http://www.tldp.org/LDP/Bash-Beginne...tml/index.html and the http://www.tldp.org/LDP/abs/html/ . If log file line items have fixed positions then with 'cut' or 'awk' you can print a field (say 'tailf logfilename 2>/dev/null|awk '{print $3}' 2>/dev/null;'), catch output in a variable, split user name and node, grep the other log for the user name and compare the node. Yes, it's that simple.
Can you help with it? Maybe you can give me a sample and I will amend it accordingly please? Cheers boss I don't have a clue in programming
 
Old 03-07-2011, 08:22 AM   #6
morph3u5
LQ Newbie
 
Registered: Feb 2011
Posts: 4

Original Poster
Rep: Reputation: 0
HELP please!!! Any one can help with this script. Thanks in advance
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse action with a shell script Sound Linux - General 4 01-11-2010 11:02 AM
Block Java Script action in squid cksoo Linux - Security 2 03-16-2008 09:33 PM
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 05:19 AM
Script to read mail and take action. kennmurrah Linux - Software 1 07-18-2007 03:10 PM
modify bash script - recursive action xscousr Programming 6 09-17-2003 02:52 PM


All times are GMT -5. The time now is 06:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration