# Logfmt

The *logfmt* parser lets you parse data in the [logfmt](https://pkg.go.dev/github.com/kr/logfmt?utm_source=godoc) format.

Here is an example parsers configuration:

{% tabs %}
{% tab title="parsers.yaml" %}

```yaml
parsers:
  - name: logfmt
    format: logfmt
```

{% endtab %}

{% tab title="parsers.conf" %}

```
[PARSER]
  Name        logfmt
  Format      logfmt
```

{% endtab %}
{% endtabs %}

The following log entry is valid for the previously defined parser:

```
key1=val1 key2=val2 key3
```

After processing, its internal representation will be:

```
[1540936693, {"key1"=>"val1",
              "key2"=>"val2"
              "key3"=>true}]
```

If you want to be more strict than the logfmt standard and not parse lines where certain keys lack values (such as `key3` in the previous example), you can configure the parser as follows:

{% tabs %}
{% tab title="parsers.yaml" %}

```yaml
parsers:
  - name: logfmt
    format: logfmt
    logfmt_no_bare_keys: true
```

{% endtab %}

{% tab title="parsers.conf" %}

```
[PARSER]
  Name        logfmt
  Format      logfmt
  Logfmt_No_Bare_Keys true
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.fluentbit.io/manual/4.0/data-pipeline/parsers/logfmt.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
