VMware {code} Community
praveenps
Contributor
Contributor

Help needed in fetching all Events from ESX host and VC

I`am trying to fetch all the events that have been logged on the ESX host. For this purpose I am using the 'CreateCollectorForEvents' SDK API. To this I`am passing an empty instance of 'EventFilterSpec'. The 'PropertySpec' is defined as below.

PropertySpec.type = "EventHistoryCollector";

PropertySpec.all = &xsd_false;

PropertySpec.pathSet.push_back("latestPage");

Using the above i`am only able to retrieve the 'login' and 'logout' type of events.

Could anyone help me with the correct usage of this API. i.e what different ways can the 'EventFilterSpec' be initialized? Also though i`am setting one of the property attribute as 'latestPage' I do not understand the actual significance of it. What should I pass if I need to get all the events that have been logged. Could anyone throw some light on this aspect. What other values can be used?

Our code is in C++/gsoap.

Our aim is to check the event log and find at what point of time a configuration paramater was changed or set? For e.g. the 'VMKernel.Boot.usbBoot'.

Any help is much appreciated.

Thanks,

--Praveen

Reply
0 Kudos
3 Replies
stumpr
Virtuoso
Virtuoso

Have you looked at setLatestPageSize? Also, do you have any events on your current hosts that aren't logon/logoff?

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
praveenps
Contributor
Contributor

Every event in the log file (hostd-*.log) has Event id associated with it, see below example (Event 1).

Event 1 : User root@127.0.0.1 logged in

But for the following entry does not have any Event id associated with it, which implies this is not an event. Am i correct?

Set called with key 'VMkernel.Boot.techSupportMode' value 'false'

Any idea, how this entries can be retieved using web svc api`s?

I tried using BrowseDiagnosticLog api, but it takes only the key as "hostd". And hostd always points to the lates log file. This does not retireve old log files data.

Example, if the key is changed to 'hostd-1" then this fails.

WE also tried using '[TaskManager|https://10.216.117.65/mob/?moid=TaskManager]', which only retrieves the log statements associated with tasks, example below.

Task Created : haTask-ha-host-vim.option.OptionManager.updateValues-19339

Set called with key 'VMkernel.Boot.PernodeBusClock' value 'false'

Task Completed : haTask-ha-host-vim.option.OptionManager.updateValues-19339

From the baove statements the 'Taskmanager' does not return the 'KernelOptionsProvider' type statements.

Any idea how to retrieve the 'KernelOptionsProvider' type log statements.

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

That isn't something I've personally tried. Have you looked at queryDescriptions? I believe the hostd.log is just a symlink to the latest hostd-#.log, so I'm doubtful there is anyway to get to the older entries through the API.

You could try generateLogBundles. It may include older log files. If I get time later today I'll take a look at it, a bit curious myself.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos