Access Logs from CURL or Wget

Hi,

We would like to monitor the logs created by Appian in our Centralised logging solution. We need the ability to access the logs via command line to pull them down to allow them to be picked up and processed.

Is anyone aware of a technique possibly using wget or cURL to enable the downloading of logs? I've tried using basic authentication from curl but it seems to hit the standard authentication page. 

 

Thank you, Lee

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Dear Lee,

    I recently had to do something similar. Here is some insight into how Appian authentication works:

    When you query a log item, you are doing a GET request to, for example,

    YOUR_ENV.appiancloud.com/.../records_usage.csv

    That GET request has a set of headers. In order to access via CURL/WGET, you need to imitate the three "cookie" headers (shown in Chrome Inspect/DevTools). In Chrome Inspect/DevTools, you can get this under the Network tab, and clicking on the name of the log file that you queried; then going to Headers (example image included below). For a successful query, include those three cookie items in your CURL request, with valid XYZ from an active session: JSESSIONID= XXXX; __appianCsrfToken=YYYY; __appianMultipartCsrfToken=ZZZZ .

    I did this with Python (Requests package, by sending those three headers highlighted as a dictionary of cookies). In other words, if you get those cookies from Chrome Inspect/DevTools, and set them as headers in WGET or CURL, you will be able to get past the login screen and into the log item (and anywhere else in Appian - a similar trick works for most websites).

    There is a catch - your session may be timed out by your environment unless you send out these WGET/CURL requests every X minutes to keep alive your session. If you want a full automation, you will need a timer to do this every X minutes, or to further automate the login to get those cookies and then execute that request. I've had to do both in Appian, so please feel free to ask any follow-up questions if this is still an issue. Hope this helps!