× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 07-Jul-2011 12:08 , fbocch2595@xxxxxxx wrote:

I'm trying to get the client info from the history log, specifically
the client IP address for the usrprf in the log msg CPIAD09. DSPLOG
doesn't have the option for outfile so I'm wondering if anyone has a
quick way to create a report for DSPLOG that will create a report of
the IP addresses from the log? If anyone has code to share on this
plz send it along.


There is an API interface [¿since perhaps IBM i 6.1 ?] which might be available. If the data is available in the auditing instead, the Display_Journal SQL UDTF [available by PTF in some release(s)] might be an option.

In the past I have used something like the following scripted requests to generate an effective output file [using an intermediate copy of the data] from some very specific history data; e.g. for data from one specific message identifier:

<code>

setup for getting log data into file within this job:

crtmsgf qtemp/myCPIAD09

mrgmsgf frommsgf(qcpfmsg) tomsgf(qtemp/myCPIAD09)
rplmsgf(*none) select(CPIAD09)

chgmsgd CPIAD09 MSG(',&8,&7,&6,&5,&4,&3,&2,&1') ccsid(37)

ovrmsgf qcpfmsg qtemp/myCPIAD09

crtpf QTEMP/QPDSPLOG rcdlen(140) lvlchk(*no) mbr(qhst)

ovrdbf QPDSPLOG QTEMP/QPDSPLOG lvlchk(*no) ovrscope(*calllvl)

gather log data; output to temporary file:

dsplog log(QHST) output(*print) /* first level msg only */
PERIOD(( ) ( )) JOB( ) /* whatever selection is desired */
msgid(CPIAD09) /* msg of interest; override to my version */

* First of two methods to generate output file and copy data.

generate output file [could be CRTDUPOBJ from a model file]:

create table qtemp/cpiad09
( pfx char(30), ip varchar(255) allocate(16)
, sbl char(10), sbs char(10), tsp char(19)
, usr char(10), jr char(6), ju char(10), jn char(10) )

copy message data from temporary to final\intended output file:

cpyfrmimpf fromfile(qpdsplog qhst) tofile(qtemp/cpiad09 *first)
mbropt(*replace) fromrcd(2 *end) errlvl(*nomax) fromccsid(37)
rcddlm(*eor) dtafmt(*dlm) strdlm(*none) flddlm(',')
/* lots of errors using this method; the rows of interest */
/* match selection: WHERE SUBSTR(PFX, 17, 7) = 'CPIAD09' */

* Alternate method to generate output file and copy data. This method eliminates extraneous data, and thus eliminates the import errors; to maintain consistency with setup, any oddities such as the leading comma in the message are dealt with:

generate output file [could be duplicated from a model file]:

create table qtemp/cpiad09
( ip varchar(255) allocate(16)
, sbl char(10), sbs char(10), tsp char(19)
, usr char(10), jr char(6), ju char(10), jn char(10) )

copy message data from temporary to final\intended output file:

crtpf qtemp/cpiad09dta rcdlen(114)

opnqryf qtemp/qpdsplog keyfld(*file)
format(qtemp/cpiad09dta) opnid(HST)
mapfld((cpiad09dta '%sst(qpdsplog 28 113)'))
qryslt('%hex(%sst(qpdsplog 2 4)) *eq "000000F1"')

cpyfrmqryf opnid(HST) tofile(qtemp/cpiad09dta) mbropt(*replace)

cpyfrmimpf fromfile(qtemp/cpiad09dta)
tofile(qtemp/cpiad09 *first)
mbropt(*replace) fromrcd(1 *end) errlvl(0) fromccsid(37)
rcddlm(*eor) dtafmt(*dlm) strdlm(*none) flddlm(',')
/* no data errors expected; one row per msg logged in PERIOD */

</code>

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.