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.
Shell ScriptingLinuxPerl

Avatar of undefined
Last Comment
srsysdoc

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Alex [***Alex140181***]

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes