Method: OvirtSDK4::EventsService#list

Defined in:
lib/ovirtsdk4/services.rb

#list(opts = {}) ⇒ Array<Event>

Get list of events.

GET /ovirt-engine/api/events

To the above request we get following response:

<events>
  <event href="/ovirt-engine/api/events/2" id="2">
    <description>User admin@internal-authz logged out.</description>
    <code>31</code>
    <correlation_id>1e892ea9</correlation_id>
    <custom_id>-1</custom_id>
    <flood_rate>30</flood_rate>
    <origin>oVirt</origin>
    <severity>normal</severity>
    <time>2016-09-14T12:14:34.541+02:00</time>
    <user href="/ovirt-engine/api/users/57d91d48-00da-0137-0138-000000000244" id="57d91d48-00da-0137-0138-000000000244"/>
  </event>
  <event href="/ovirt-engine/api/events/1" id="1">
    <description>User admin logged in.</description>
    <code>30</code>
    <correlation_id>1fbd81f4</correlation_id>
    <custom_id>-1</custom_id>
    <flood_rate>30</flood_rate>
    <origin>oVirt</origin>
    <severity>normal</severity>
    <time>2016-09-14T11:54:35.229+02:00</time>
    <user href="/ovirt-engine/api/users/57d91d48-00da-0137-0138-000000000244" id="57d91d48-00da-0137-0138-000000000244"/>
  </event>
</events>

The following events occur:

  • id="1" - The API logs in the admin user account.

  • id="2" - The API logs out of the admin user account.

The order of the returned list of events is always garanteed. If the sortby clause is included in the search parameter, then the events will be ordered according to that clause. If the sortby clause isn’t included, then the events will be sorted by the numeric value of the id attribute, starting with the highest value. This, combined with the max parameter, simplifies obtaining the most recent event:

GET /ovirt-engine/api/events?max=1

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :case_sensitive (Boolean)

    Indicates if the search performed using the search parameter should be performed taking case into account. The default value is true, which means that case is taken into account. If you want to search ignoring case set it to false.

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :from (Integer)

    Indicates the event index after which events should be returned. The indexes of events are strictly increasing, so when this parameter is used only the events with greater indexes will be returned. For example, the following request will return only the events with indexes greater than 123:

    GET /ovirt-engine/api/events?from=123

    This parameter is optional, and if not specified then the first event returned will be most recently generated.

  • :max (Integer)

    Sets the maximum number of events to return. If not specified all the events are returned.

  • :search (String)

    The events service provides search queries similar to other resource services.

    We can search by providing specific severity.

    GET /ovirt-engine/api/events?search=severity%3Dnormal

    To the above request we get a list of events which severity is equal to normal:

    <events>
      <event href="/ovirt-engine/api/events/2" id="2">
        <description>User admin@internal-authz logged out.</description>
        <code>31</code>
        <correlation_id>1fbd81f4</correlation_id>
        <custom_id>-1</custom_id>
        <flood_rate>30</flood_rate>
        <origin>oVirt</origin>
        <severity>normal</severity>
        <time>2016-09-14T11:54:35.229+02:00</time>
        <user href="/ovirt-engine/api/users/57d91d48-00da-0137-0138-000000000244" id="57d91d48-00da-0137-0138-000000000244"/>
      </event>
      <event href="/ovirt-engine/api/events/1" id="1">
        <description>Affinity Rules Enforcement Manager started.</description>
        <code>10780</code>
        <custom_id>-1</custom_id>
        <flood_rate>30</flood_rate>
        <origin>oVirt</origin>
        <severity>normal</severity>
        <time>2016-09-14T11:52:18.861+02:00</time>
      </event>
    </events>

    A virtualization environment generates a large amount of events after a period of time. However, the API only displays a default number of events for one search query. To display more than the default, the API separates results into pages with the page command in a search query. The following search query tells the API to paginate results using a page value in combination with the sortby clause:

    sortby time asc page 1

    Below example paginates event resources. The URL-encoded request is:

    GET /ovirt-engine/api/events?search=sortby%20time%20asc%20page%201

    Increase the page value to view the next page of results.

    GET /ovirt-engine/api/events?search=sortby%20time%20asc%20page%202
  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



9166
9167
9168
# File 'lib/ovirtsdk4/services.rb', line 9166

def list(opts = {})
  internal_get(LIST, opts)
end