How to ignore default fields

See original GitHub issue

Hi,

could you please document, how default fields could be ignored? For me, there is no use for these default fields: logger_name, thread_name, level, level_value, HOSTNAME and I want to get rid of them. The single-word names are ignored by just <level>[ignore]</level> (as documented) but the two-word names are not so obvious. By little experimenting, I found almost all keys logger_name = logger, thread_name = thread, level_value = levelValue but I am not able to find out correct key for HOSTNAME.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8

github_iconTop GitHub Comments

14reactions
jonvargascommented, Oct 21, 2018

Thanks jama707, your last reply was pretty helpful, and yes, there should be consistency. Now, this works:

        <encoder class="net.logstash.logback.encoder.LogstashEncoder">
            <includeContext>false</includeContext>
            <includeCallerData>true</includeCallerData>
            <fieldNames>
                <timestamp>timestamp</timestamp>
                <message>message</message>
                <thread>[ignore]</thread>
                <logger>[ignore]</logger>
                <version>[ignore]</version>
                <levelValue>[ignore]</levelValue>
                <caller>trace</caller>
                <stackTrace>exception</stackTrace>
                <mdc>context</mdc>
            </fieldNames>
        </encoder>
2reactions
philsttrcommented, Jul 22, 2015

logger_name, version, thread_name, level, level_value are not in the MDC.

To disable those, you’ll need to set their field names to [ignore] as mentioned here

I’ve never seen logs.home before, so I’m not sure where that is coming from.

However, if you are removing all the default fields, I would suggest using the composite encoder instead of the LogstashEncoder. The composite encoders allow you to selectively add things as needed (rather than removing things).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to ignore default fields · Issue #98 - GitHub
However, if you are removing all the default fields, I would suggest using the composite encoder instead of the LogstashEncoder . The composite ......
Read more >
Exclude 'default'/'system' fields in `table *` - Splunk Community
Does anyone know if there's a way to exclude them without naming them all individually via a built in method/variable? e.g. `index=myindex | ......
Read more >
Ignore default field values for JSON deserialization
Try creating a @JsonSetter for that field public class Dto { private name = "test"; @JsonSetter("name") public void nameJsonSetter(String ...
Read more >
Remove or disable default fields - Elasticsearch - Elastic Discuss
Hi i want to know that if we can remove default fields or not in elasticsearch i mean : "_index" : "iislogs", "_type"...
Read more >
Remove default fields and add New | WordPress.org
Hi, I am using a theme, which uses cmb2 and WPJobBoard Plugin, There are some default fields under custom post type job listing....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found