ServerLogs
Uses the ssh integration to grab the host server logs. This script is supported only on Cortex XSOAR on-prem (version 6.X).
- Type
- python
- Pack
- CommonScripts
Source
import re
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def execute_ssh_command():
"""Execute the `ssh` command to get the server logs and return the result to the war room."""
file = "/var/log/demisto/server.log"
res = demisto.executeCommand("ssh", {"cmd": f"tail {file}", "using": "localhost"})
output = f"File: {file}\n"
output += res[0].get("Contents").get("output")
output = re.sub(r" \(source: .*\)", "", output)
return_results(output)
def main():
try:
execute_ssh_command()
except ValueError as e:
demisto.error(str(e))
return_error(
"The script could not execute the `ssh` command. Please create an instance of the"
"`RemoteAccess v2` integration and try to run the script again."
)
if __name__ in ("__builtin__", "builtins", "__main__"):
main()
README
Uses the ssh integration to grab the host server logs
This script is supported only on Cortex XSOAR on-prem (version 6.X).
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | widget |
| Cortex XSOAR Version | 6.0.0 |
Inputs
There are no inputs for this script.
Outputs
There are no outputs for this script.