Link to home
Start Free TrialLog in
Avatar of srsysdoc
srsysdoc

asked on

Shell Script to find a string in server(s) log file

Hello Experts.

I want a shell script to find out the Pin Code to enter to the secure servers.

Setup: Pin is generated any one of our Four servers( Ex: pinser1,pinser2,pinser3,pinser4). whenever user is trying to access a secure server, A pin code is generated on above mentioned servers and always users are grepping the pin code in server file using his employee number. A user always entered to the four servers and searching the  pin code.

To overcome this issue, I want a shell script to search all servers and print the Pin code with the help of his employee code.

For example

1) Once he run the script, it should ask his employee number ( Ex: GS66778)
2) After he submitted the Employee Number It should connect to all servers and print the generated pin code.


log path for four servers : /var/log/genpin.log
connecting to servers ssh pin@pinser1 ( All ssh keys are exported to all servers so no need of password authentication)

 ----Enter Employee ID---
----Establish a connection to Four servers---
----search the pin code string in mentioned log files--

Experts please help me.

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Alex [***Alex140181***]
Alex [***Alex140181***]
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of srsysdoc
srsysdoc

ASKER

Thanks it's working fine.

One more question. Is it possible to search and  get the latest generated Pin code on the four servers.