# Convert normal logstash output to json output for adx ingestion

**URL:** <https://discuss.elastic.co/t/convert-normal-logstash-output-to-json-output-for-adx-ingestion/336138>\
**Category:** Logstash\
**Created:** [June 15, 2023, 8:09pm UTC](https://discuss.elastic.co/t/convert-normal-logstash-output-to-json-output-for-adx-ingestion/336138 "2023-06-15T20:09:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashokkrishna99\_Vemur](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashokkrishna99\_Vemur](https://discuss.elastic.co/u/ashokkrishna99_Vemur)\
**Post date:** [June 15, 2023, 8:09pm UTC](https://discuss.elastic.co/t/convert-normal-logstash-output-to-json-output-for-adx-ingestion/336138/1 "2023-06-15T20:09:13Z")

</div>

I have been working on transferring Palo Alto firewall logs(syslog format) to ADX. To achieve this, I developed grok filters and incorporated kv and mutate filters as well. However, I encountered an issue where the output was not in the desired JSON format. To address this, I applied the 'codec =\> json' configuration within the Kusto plugin, and it successfully resolved the problem. Nevertheless, I'm uncertain if this approach is considered a best practice or if it might potentially cause any complications."

```auto
output {
    kusto {
            codec => json
            path => "/tmp/kusto/%{+YYYY-MM-dd-HH-mm-ss}.txt"
            ingest_url => "https://ingest-<cluster name>.kusto.windows.net/"
            app_id => "<application id>"
            app_key => "<application key/secret>"
            app_tenant => "<tenant id>"
            database => "<database name>"
            table => "<target table>" # logs as defined above
            json_mapping => "<mapping name>" # basicmsg as defined above
    }
}

```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 15, 2023, 8:26pm UTC](https://discuss.elastic.co/t/convert-normal-logstash-output-to-json-output-for-adx-ingestion/336138/2 "2023-06-15T20:26:11Z")

</div>

If you want JSON formatted output then it is appropriate to use a json codec.

---

<div class="post-metadata">

**Author:** ![ashokkrishna99\_Vemur](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ashokkrishna99\_Vemur](https://discuss.elastic.co/u/ashokkrishna99_Vemur)\
**Post date:** [June 15, 2023, 8:51pm UTC](https://discuss.elastic.co/t/convert-normal-logstash-output-to-json-output-for-adx-ingestion/336138/3 "2023-06-15T20:51:23Z")

</div>

Indeed, my ADX plugin specifically requires input in JSON format, which is why I require JSON formatting. Initially, I considered using a filter such as `{json { source => syslog_message }}` to achieve this. However, I found that implementing such a filter was making things more complex and convoluted. Therefore, I opted for the simpler solution of utilizing the `codec => json` configuration.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 13, 2023, 8:52pm UTC](https://discuss.elastic.co/t/convert-normal-logstash-output-to-json-output-for-adx-ingestion/336138/4 "2023-07-13T20:52:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
