Post by wbreidbachPost by Ivak .Hi,
I am using EMS command as below.
TACL>emsdist co $0,ty p,te [#myterm]
However, I need to specify the keyword in above command. Based on that
keyword, the events should be displayed on screen.
Ex;
TACL>emsdist co $0,ty p,te [#myterm]
\system1.$SYSTEM.SYSTEM 7> emsdist co $0,ty p,te [#myterm]
11-01-18 06:14:08 \system2,1193 TANDEM.EMS.H01 000512
NSBGCT:The
212162071040773452
.
.
.
.
.
.
.
Here, there are so many ems events emitted from different sub systems.
But,I am just concerned about my events which have always prefixed by
specific keyword. Here it is "NSBGCT"
I came across FILTER options. However it needs command file, and it
seems, it filters based on the subsystem name, but keyword.
Looking forward for your valuable suggestions.
Thanks,
Ivak.
Ivak,
it seems you are just writing your output to $0, so all you get is a
simple text message type 512. Unfortunately that type of message is
rather common and not a good criteria for searching the log.
I have been using and writing filters for many years and I have always
successfully avoided to scan the text itself.
Writing a filter is described in the EMS manual. As far as I remember
you have the chance to scan the text within a filter.
Here is a sample for filtering 512-messages.
#PUSH DUMMY
#LOAD /KEEP 1, LOADED DUMMY/$SYSTEM.ZEMSDEF.ZSPITACL
#POP DUMMY
FILTER FIL512;
BEGIN
IF ZEMS^TKN^EVENTNUMBER = 512 THEN PASS
ELSE FAIL;
END;
emf /in fil512/ofil512
The compiled filter ofil512 can now be used with the EMSDIST program
with the FILTER parameter.
As a result, EMSDIST would only list type 512 messages.
My recommendation would be to produce real EMS-messages instead of
those text messages. That is much easier than most people think and
information about that can be taken from another thread just a few
weeks ago.
I believe what Wolfgang wrote is mostly correct. I believe the filter he shows will cause EMSDIST to display event number 512 from any subsystem, not just the EMS 512 events. It might be the case that few other subsystems have events numbered 512, so testing just the event number probably works well most of the time. I will show a filter below that tests both the subsystem and the event number.
Wolfgang is right that EMS really was intended to have the events be tokenized rather than just plain text messages. The ability to handle plain text messages was a backwards compatibility feature, intended to be used less and less over time. But if plain text messages is what you must work with, there are ways to do that.
If selecting just the EMS 512 events for display reduces the amount of output enough that you can easily find the messages that you want to see, then the filter Wolfgang showed you will be enough (possibly modified to select only events from EMS numbered 512).
If there still are too many events displayed, even when limited to only the EMS 512 events, there are at least two things you could do. One would be to send the output from EMSDIST to the spooler, then use the PERUSE FIND command to search the spooler job for the keyword. I assume you know how to use PERUSE to do this, so I will not explain it here. If you want further explanation of how to use PERUSE this way, post again to ask about that.
Another thing you could do is modify the filter to use the MATCH function in the filter to select only the EMS 512 events whose text token contains the keyword. This means that you would have to modify the filter and recompile it each time you need a different keyword. If there are only a few keywords you need to use, you could create and compile a filter for each keyword in advance, then when you run EMSDIST, simply specify the compiled filter that tests for the desired keyword.
A filter that would select messages that contain NSBGCT would be:
[#SET ZEMS^VAL^SSID [ZSPI^VAL^TANDEM].[ZSPI^SSN^ZEMS].[ZEMS^VAL^VERSION]]
FILTER NSBGCT;
BEGIN
IF NOT (ZSPI^TKN^SSID = SSID(ZEMS^VAL^SSID) THEN FAIL;
IF NOT (ZEMS^TKN^EVENTNUMBER = 512) THEN FAIL;
IF MATCH(ZEMS^TKN^TEXT,"*NSBGCT*") THEN PASS
ELSE FAIL;
END;
Put those lines into an Edit file, for this example call it NSBGCT, then compile it as follows:
#PUSH DUMMY
#LOAD /KEEP 1, LOADED DUMMY/$SYSTEM.ZEMSDEF.ZSPITACL
#LOAD /KEEP 1, LOADED DUMMY/$SYSTEM.ZEMSDEF.ZEMSTACL
#POP DUMMY
EMF/IN NSBGCT/ ONSBGCT
Then you can use the compiled filter in the EMSDIST command:
EMSDIST TYPE P,COLLECTOR $0,TEXTOUT [#MYTERM],FILTER ONSBGCT
If there is not just one or a small set of keywords that you want to use to look for events, but want to give an arbitrary keyword each time, you could create a TACL macro based on the above that takes the keyword as its argument. Have the macro create the filter in an Edit file (using the parameter value in the MATCH), compile the filter, and run EMSDIST using it.
I do not have access to a NonStop system, so I cannot test the above to be sure I have everything exactly correct. I am pretty sure it is very close to correct, but there could be some mistakes. If it does not work, and you cannot figure out how to fix it yourself, post again to show what the problem is and we probably can tell you how to fix it.
Your system might have the token definition files on a volume different from $SYSTEM, so you might have to change $SYSTEM in the above to whatever volume is correct for your system.
There are variations possible in the details of how you create a filter, so what I show here is not the only way it could be done. For example, the manual says that EMF can take input from a TACL variable using INV, so you do not absolutely have to put the filter into an Edit file. You could use ATTACHSEG instead of LOAD to make the token definitions available. Etc.
Yet another approach would be to use the SPI interface to EMSDIST from a TACL routine to retrieve the events and do the filtering in your TACL code before displaying the message, but that probably is more work than you want to do, and would be much more code than I would want to try to write without being able to debug it.
If there were a simple way to direct the output of EMSDIST to an OSS pipe, you could pipe it to a grep command to select the lines you want to display, but I cannot immediately think of a simple way to do that since I think EMSDIST does not write to its OUT file. And messages whose display takes more than one line would not show the whole message that way, so it probably is not a very good approach.
I am pretty sure that the Viewpoint program has a way to display messages that match a keyword, but you probably would not want to set up a Viewpoint system just for that purpose. There is a web browser version of Viewpoint that might be easier to set up and use, but I know little more than that it exists (and I do not know whether it has the keyword filtering feature you want).
I know I have heard of other programs that can display events from the EMS log, and I believe some of them include the ability to select events by keyword, but I do not remember what those programs are called, where they come from, etc. I imagine some of them are sold by other companies that provide NonStop management tools. There might be a couple such programs in the ITUG contributed library. There might be a few free ones available other places. Perhaps someone else will post a reply that tells of such programs.