Link to home
Start Free TrialLog in
Avatar of dsingh006
dsingh006Flag for United States of America

asked on

Need command to search syslogs

Hi Experts
I am trying to track down an IP address on a unix DNS server using /var/log/syslog. However overwhelmed with data. I know very little of unix but I remember the Grep command as the "search" command. What would the command line be to pull the desired IP from this log?

Thanks in advance
D. arno
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

grep "123.123.123.123" /var/log/syslog
Avatar of dsingh006

ASKER

Yes I had tried that but this is the results
sudo less grep "xxx.xxx.xxx"/var/log/syslog
[sudo] password for mmmmm:
grep: No such file or directory
xxx.xxx.xxx/var/log/syslog: No such file or directory

Then it continues on to the whole log file
Try it this way:

sudo sh -c "grep xxx.xxx.xxx /var/log/syslog | less "
sudo should not be necessary. Syslog files are generally world-readable.

Leave a space between "123.123.123.123" and the filename.

And for the "less" thing - gt2847c's suggestion is correct.
ASKER CERTIFIED SOLUTION
Avatar of gt2847c
gt2847c
Flag of United States of America 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