Link to home
Start Free TrialLog in
Avatar of NAMEWITHELD12
NAMEWITHELD12Flag for United States of America

asked on

powershell Get-EventLog -Log "Application"

how can i tail this log ?

thanks !!!
Avatar of Sajid Shaik M
Sajid Shaik M
Flag of Saudi Arabia image

Hi,

You can use Get-EventLog -Log "Application"  | where {$_.eventID -eq 902} for explicit and simple queries , but you cant use  Hash table to filter out the results , for that you need to use Get-WinEvent cmdlet its bit flexible and powerful
For example you can use the below cmdlet to get the same output
Get-WinEvent  -FilterHashtable  @{ logname = 'application'  ; id=902 }  -MaxEvents 20
for more details,
https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.diagnostics/get-winevent?f=255&MSPPError=-2147217396

Thanks,
Dinesh
Avatar of NAMEWITHELD12

ASKER

thanks , but how can I follow the log , like in linux we can do a "tail -f" to follow the output of  a log

for example :
# tail -f -s 5 /var/log/secure
Mar 20 12:43:27 sa su: pam_unix(su:session): session opened for user rabbitmq by (uid=0)
Mar 20 12:43:27 sa su: pam_unix(su:session): session closed for user rabbitmq
Mar 20 12:43:27 sa su: pam_unix(su:session): session opened for user rabbitmq by (uid=0)
Mar 20 12:43:28 sa su: pam_unix(su:session): session closed for user rabbitmq
Mar 20 12:43:28 sa su: pam_unix(su:session): session opened for user rabbitmq by (uid=0)
ASKER CERTIFIED SOLUTION
Avatar of Dinesh Babu
Dinesh Babu
Flag of India 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
thanks