galasa-dev / projectmanagement

Project Management repo for Issues and ZenHub
7 stars 3 forks source link

Add zos console services "Get messages from logs" feature #805

Open guitardozer opened 2 years ago

guitardozer commented 2 years ago

I'd like this feature for the z/OSMF console services to be implemented in Galasa (to the z/OS Console Manager if applicable). This feature enables a user to get the messages from logs on your system, with a few optional parameters.

This operation retrieves the messages that were issued in response to a command that was issued asynchronously with the Issue Command service. For more information about the Issue Command service, see Response content.

On successful completion, HTTP status code 200 is returned. The response content is described in Table 3.

Resources: Get messages from logs z/OS console services

Michael-Baylis commented 2 years ago

@DavidXRoberts may I have your comments on this please

DavidXRoberts commented 2 years ago

We certainly could implement this, but there are few issues, which I'm sure are solveable: This is a zOS 2.4 API but isn't available on our systems. I guess we're back level on maintenance. We'd need to implement a zOSMF version check. The IZosConsole interface has multiple implementations. Wouldn't be able to provide an oeconsol implementation. Not sure where this could fit in with other priorities.

An alternative (permanent or otherwise) would be for @guitardozer to use the zOSMF Manager directly. IZosmfManagerSpi is the Manager interface, or from a test:

@ZosImage(imageTag="A")
public IZosImage zosImageA;

@Zosmf(imageTag="A")
public IZosmf zosmf;

@Test
public void testGet() throws ZosmfException {
    IZosmfResponse response = zosmf.get("/zosmf/restconsoles/v1/log?time=2021-05-25T07:00Z&timeRange=1h", new ArrayList<>(Arrays.asList(HttpStatus.SC_OK)), false);
    JsonObject content = response.getJsonContent();
    int totalitems = content.get("totalitems").getAsInt();
    JsonArray items = content.getAsJsonArray("items");
    for (int i = 0; i < totalitems; i++) {
        JsonObject item = items.get(i).getAsJsonObject();
        String messageId = item.get("messageId").getAsString();
        String message = item.get("message").getAsString();
        . . .
    }
}
guitardozer commented 2 years ago

To help with your maintenance search, it was introduced with APAR PH35930 and cor closed on 07/02/2021 for 2.4.

Yeah, I imagine it would only work for zOSMF. Thank you for sharing that snippet. I can try and toy with that at some point.

Michael-Baylis commented 2 years ago

We would add an exception to the oeconsol implementation to say it is not supported. I have put this on the general backlog. not sure we will get back to it in the next couple of months. MV2D is at 2.4, so we have systems we can use to test it with.