i'm trying to download system events logs using bash curl and getting authentication error
curl -u 'fortigate_user:fortigate_pass' 'https://<fortigate ip address>/api/v2/log/memory/event/system/raw' --compressed --insecure
and getting following authentication error:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<p>Additionally, a 401 Unauthorized
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
how can we passthrough the API login for curl command (-u 'fortigate_user:fortigate_pass' ) in order to download the log?
note: if i login to FortiGate via chrome and on other tab to 'https://<fortigate ip address>/api/v2/log/memory/event/system/raw' i'm able to download the log (session token) , but we aim to download it from bash command line
Solved! Go to Solution.
Nominating a forum post submits a request to create a new Knowledge Article based on the forum post topic. Please ensure your nomination includes a solution within the reply.
Hi @noamsh88 ,
the easiest way is to authenticate by using API Key. But you can also login with your credentials and then use the session cookie.
Both methods are described at https://community.fortinet.com/t5/FortiGate/Technical-Tip-About-REST-API/ta-p/195425
Hi @noamsh88 ,
the easiest way is to authenticate by using API Key. But you can also login with your credentials and then use the session cookie.
Both methods are described at https://community.fortinet.com/t5/FortiGate/Technical-Tip-About-REST-API/ta-p/195425
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1733 | |
1106 | |
752 | |
447 | |
240 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.