> For the complete documentation index, see [llms.txt](https://thorstenkramm.gitbook.io/saltstack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thorstenkramm.gitbook.io/saltstack/output.md).

# Output

### Weniger gesprächig

Mit dem Parameter `--state-ouput`  können Sie die Menge an Informationen auf der Konsole reduzieren.&#x20;

> Der State-Outputter hat u.A. folgende Ausgabemodi: `full` (voll), `terse` (knapp), `mixed` (gemischt), und `changes` (Änderungen).
>
> Die Standardeinstellung ist `full`, wodurch viele Zeilen mit detaillierten Informationen für jeden ausgeführten Chunk angezeigt werden.
>
> Bei `terse` wird die Ausgabe stark vereinfacht und in nur einer Zeile angezeigt.
>
> Bei der Einstellung `mixed` wird eine knappe Ausgabe verwendet, es sei denn, ein Zustand ist fehlgeschlagen; in diesem Fall wird die vollständige Ausgabe verwendet.
>
> Wenn `changes` verwendet wird, wird terse ausgegeben, wenn kein Fehler und keine Änderungen aufgetreten sind, andernfalls wird die vollständige Ausgabe verwendet.

```
salt \* state.apply users --state-output=terse
salt \* state.apply users --state-output=terse --state-verbose=false
```

<figure><img src="/files/fAzHgt1bPoNn25qMFBJ0" alt=""><figcaption></figcaption></figure>

Alle Optionen nachzulesen in der 📖 [Salt Dokumentation](https://docs.saltproject.io/en/latest/ref/output/all/salt.output.highstate.html).

Wenn die Rückgabe mit der Option `terse` stark verkürzt wird, gegen unter Umständen wichtige Informationen zur Fehleranalyse verloren. Nutzen Sie ein zusätzliches Logfile, um alle Details in einer Datei zu speichern. Beispiel:

```
salt <minion> state.apply <state> \
  --state-output=terse --state-verbose=false \
  --log-file=/tmp/salt.log --log-file-level=debug
```

Die Details der Salt-Rückgabe werden im Logfile als Python-Dictionary gespeichert. Das ist  schwer lesbar. Mit dem nachfolgenden Script können Sie das Logfile in eine formatierte Json-Ausgabe umwandeln.

{% code title="/usr/local/bin/read-salt-log.py" %}

```python
#!/usr/bin/env python3
import json
import sys
import re

for line in sys.stdin:
    match = re.match("([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}).*return event: (.*)", line)
    if match:
        print(match.group(1))
        print(json.dumps(eval(match.group(2)),indent=4))
```

{% endcode %}

```
chmod +x /usr/local/bin/read-salt-log.py
read-salt-log.py < /tmp/salt.log
```

<figure><img src="/files/xFxba3fBS3lIuQ5SRW21" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://thorstenkramm.gitbook.io/saltstack/output.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
