Thanks for your reply Jim.

The Lab Services produce does look quite good but also has an IBM style
price tag.

We are using the SQL style to extract log entries in syslog format from
the history log and audit journal.

Curl was just a simple ish solution to get it working.

I did try to use the syslog daemon some time back with no success and as
this attempt with curl was working I did not go back to investigate more
on that option.

As far as CCSID the data is arriving on the GreyLog server successfully
and displays correctly so maybe I got lucky ? the job CCSID is 37.

As @jon has suggested HTTPAPI will be a much better solution and what I am
going to do now.

Thank you for your reply and comments

Don





From: "Jim Oberholtzer" <midrangel@xxxxxxxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion"
<midrange-l@xxxxxxxxxxxxxxxxxx>
Date: 08/09/2021 09:39 PM
Subject: Re: How to monitor for a curl error
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>



This discussion got me thinking about syslog and a question came up.

IBM added support in SQL to extract syslog style messages a while back,
and after reading the tech note, (search for 634791) it does not appear
to need much on the side of IBM i before the messages get dealt with in
PACE, where curl would not have the connection issue. There’s a syslogd
daemon that will then get the messages over to Greylog where the messages
can be handled, ( or ignored) so I’m wondering why the curl from ILE is
being used. Furthermore if I’m not mistaken the ccsid needs to be 1200
for the syslog not 37 ( US anyway) so that leaves more questions.

Interesting topic, but it opens up a bunch of questions. Also Lab
Services has a product to do this as well, if there is a strong need for
it.

Jim Oberholtzer
Agile Technology Architects



On Sep 8, 2021, at 4:42 AM, Patrik Schindler <poc@xxxxxxxxxx> wrote:

Hello Don,

Am 08.09.2021 um 09:55 schrieb Don Brown via MIDRANGE-L
<midrange-l@xxxxxxxxxxxxxxxxxx>:

This works but I have found if there are many messages to be written I
can
get an error
curl: (7) Failed to connect ... connection refused

This message appears in the joblog

Yes, this is clearly the other side not accepting (another) connection.

My call looks like this;

callp(e) QCmdExc(Cmd:CmdLen);
if %error();

I do get an error but how do I retrieve the actual error that is being
sent to the job log (or the qsh session if run interactively) ?

In Unix, shell commands give return values. Sometimes, they're
meaningful, sometimes, it's just "if not 0, then error".

After running a shell command, the return value can be used in multiple
ways. It can be obtained from the environment variable $?:

true; echo $?
=> 0

false; echo $?
=> 1

(True and false are shell commands just returning 0 or 1.)

So, in theory you can do a

until curl …; sleep 1; done

This makes curl run again and again through a loop until it returns 0.
Tried the basic syntax out with 7.2; works.

I have no experience with running UNIX commands in qsh and how/if the
return value is passed back to the caller. Maybe others can chime in here?

I think the server is just having a hard time keeping up so if I get
this error I was going to retry sending the post or perhaps put a short
sleep to handle this issue.

I wonder if hammering each syslog message to Greylog in a separate http
request is a good idea at all. :-)

Appreciate any suggestions

I've not yet played with Greylog, so I can't give you an opinion here.
Sorry.

:wq! PoC

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.