<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [getScriptLogs](./bitburner.ns.getscriptlogs.md)

## NS.getScriptLogs() method

Get all the logs of a script.

**Signature:**

```typescript
getScriptLogs(fn?: FilenameOrPID, host?: string, ...args: ScriptArg[]): string[];
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

fn


</td><td>

[FilenameOrPID](./bitburner.filenameorpid.md)


</td><td>

_(Optional)_ Optional. Filename or PID of script to get logs from.


</td></tr>
<tr><td>

host


</td><td>

string


</td><td>

_(Optional)_ Optional. Hostname/IP of the server that the script is on.


</td></tr>
<tr><td>

args


</td><td>

[ScriptArg](./bitburner.scriptarg.md)<!-- -->\[\]


</td><td>

Arguments to identify which scripts to get logs for.


</td></tr>
</tbody></table>

**Returns:**

string\[\]

Returns a string array, where each line is an element in the array. The most recently logged line is at the end of the array.

## Remarks

RAM cost: 0 GB

Returns a running script’s logs. The logs are returned as an array, where each line is an element in the array. The most recently logged line is at the end of the array. Note that there is a maximum number of lines that a script stores in its logs. This is configurable in the game’s options. If the function is called with no arguments, it will return the current script’s logs.

This function only works for currently running scripts. Use [getRecentScripts](./bitburner.ns.getrecentscripts.md) to access logs from recently finished scripts.

Otherwise, the PID or filename, hostname/ip, and args… arguments can be used to get logs from another script. Remember that scripts are uniquely identified by both their names and arguments.

## Example


```js
//Get logs from foo.js on the current server that was run with no args
ns.getScriptLogs("foo.js");

//Open logs from foo.js on the foodnstuff server that was run with no args
ns.getScriptLogs("foo.js", "foodnstuff");

//Open logs from foo.js on the foodnstuff server that was run with the arguments [1, "test"]
ns.getScriptLogs("foo.js", "foodnstuff", 1, "test");
```

