VMware Cloud Community
VMbkota
Enthusiast
Enthusiast

How can I get ESXi log of a specific date

Hello All,

How can I get the ESXi log of a specific date?
 
 
How many days/month does ESXi store the logs?
 
 
If I want to get logs for 2 months back, can I?
 
 
Thanks,
 
 
Labels (1)
0 Kudos
1 Reply
mlnelson
Contributor
Contributor

To get a specific date you can always from the ESXi CLI run:

cat <logname> | egrep "^2022-05-15" to get a specific date. 

Logs are not stored by date but by size and number of files. The logs rotate through the files so saying exactly 'how' long a long will be around is determined by those two factors. And since depending on the status of the system amount of logging happening can vary widely you can't say 'set the logs to X and that's two months'. It definitely depends. See https://kb.vmware.com/s/article/1004795 for some information on setting the number and size of the logs.

Realistically if you want to go two months back - you need to send the logs to someplace else such as a syslog server. That's always the recommendation and best practice - after all the logs do you no good troubleshooting a machine when it's down and you can't see the logs. VMware of course offers vRealize Log Insights and of course there are a ton of 3rd party logging offerings out there both open source and commercial.