Link to home
Create AccountLog in
Avatar of 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.
Avatar of Alex [***Alex140181***]
Alex [***Alex140181***]
Flag of Germany image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of srsysdoc


Thanks it's working fine.

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