|
I originally posted this on the new skottent.com forum but have had no
replies in a week so I am re-posting here.
Since then I have tried changing the CCSID of the syslog.txt file that
contains the log entry to 1208 but no difference. I have also played with
the format of the file removing the single quotes, trying double quotes
etcetera but the same response is always received.
I am trying to post an entry to a GreyLog syslog server.
I can successfully post a log using curl from a strqsh session - see
example below.
But when I try using the HTTPAPI Command it fails which I was using for a
quick test and perhaps is a limitation of the command ??
This works
The following commands are run before starting qsh
ADDENVVAR ENVVAR(QIBM_QSH_CMD_ESCAPE_MSG) VALUE(Y)
ADDENVVAR ENVVAR(QIBM_MULTI_THREADED) VALUE(Y)
strqsh
/QOpenSys/pkgs/bin/curl -X POST -H 'Content-Type: application/json' -d '{
"version": "1.1", "host": "example.org", "short_message
": "Testing from QSH using Curl", "level": 5, "_some_info": "foo" }' '
http://Bnelog1.xxxxxx.local:12201/gelf'
$
The $ tells me no error was detected and the entry does appear in the
syslog server
But using HTTPAPI Command no entry is received in the syslog server
HTTPAPI URL('http://Bnelog1.xxxxxx.local:12201/gelf')
DOWNLOAD('/home/msd/result.txt')
REQTYPE(*POST) UPLOAD('/home/msd/syslog.txt') TYPE('application/json')
DEBUG('/home/msd/debug.txt')
13 HTTP/1.1 202 Accepted
The syslog.txt contains
************Beginning of data**************
'{ "short_message": "This is a short message", "full_message":"This is th
efull message ", "host":"Hostname", "version":"Version
", "timestamp": "1629332852.490", "level": "01" }'
************End of Data********************
The result.txt is empty
The debug.txt contains
************Beginning of data**************
HTTPAPI Ver 1.42 released 2020-10-12
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R3M0
New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: XXXXX.LOCAL
DNS server found: 192.168.126.2
DNS server found: 192.168.126.3
DNS server found: 10.100.0.210
Nagle's algorithm (TCP_NODELAY) disabled.
http_persist_post(): entered
http_persist_req(POST) entered.
http_long_ParseURL(): entered
http_long_ParseURL(): entered
do_oper(POST): entered
There are 0 cookies in the cache
POST /gelf HTTP/1.1
Host: Bnelog1.xxxxx.local:12201
User-Agent: http-api/1.43
Content-Type: application/json
Content-Length: 182
sendraw(): entered
'{ "short_message": "This is a short message", "full_message":"This is th
efull message ", "host":"Hostname", "version":"Version", "timestamp":
"1629332852.490", "level": "01" }'
recvresp(): entered
HTTP/1.1 202 Accepted
content-length: 0
connection: keep-alive
SetError() #13: HTTP/1.1 202 Accepted
recvresp(): end with 202
recvdoc parms: identity 0
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
recvdoc(): Receiving 0 bytes.
recvdoc(): Nothing to receive, exiting...
SetError() #13: HTTP/1.1 202 Accepted
http_close(): entered
************End of Data********************
Any suggestions appreciated.
--
This email has been scanned for computer viruses. Although MSD has taken reasonable precautions to ensure no viruses are present in this email, MSD cannot accept responsibility for any loss or damage arising from the use of this email or attachments..
As an Amazon Associate we earn from qualifying purchases.
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.