Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filebeat: File specific document type, fields, tags #719

Closed
oazabir opened this issue Jan 14, 2016 · 13 comments
Closed

Filebeat: File specific document type, fields, tags #719

oazabir opened this issue Jan 14, 2016 · 13 comments

Comments

@oazabir
Copy link

oazabir commented Jan 14, 2016

We usually host multiple virtual directories in a web server. We need to configure one file beat instance to ship logs of all the virtual directories. However, logs for each file needs to have its own tags, document type and fields. Otherwise they have to be all in one format and gets dumped into one index.

We should have a hierarchical format like this:

path:

  • /var/httpd/site1.log
    • input_type: log
    • document_type: apachecommon
    • fields: [ "system": "site1", "group": "apachelog" ]
    • tags: [ "site1" ]
    • index: site1-logstash-YY.MM.dd
  • /var/weblogic/site2.log
    • input_type: log
    • document_type: weblogic
    • fields: [ "system": "site2", "group": "weblogiclog" ]
    • tags: [ "site2" ]
    • index: site2-logstash-YY.MM.dd
@oazabir
Copy link
Author

oazabir commented Jan 14, 2016

Or we could adopt a fluentd style model where each path just gets a tag. Then later part of the configuration file, we define the fields, index, document_type etc attributes for each tag.

For ex,

path: 
   tag1: /var/httpd/site1.log
   tag2: /var/httpd/site2.log


tags:
   tag1: 
          input_type: log
          document_type: apachecommon
          ...
   tag2:
          index: ....
          fields: ....

@ruflin
Copy link
Collaborator

ruflin commented Jan 14, 2016

You can have different fields per file if you use one prospector per file and define fields for each prospectors. We already have tags per beat. Are there things you cannot map with the fields in the prospector?

@oazabir
Copy link
Author

oazabir commented Jan 15, 2016

Ah that should do. I did not notice the multiple prospector.

Now just need different tags for different prospector.

@ruflin
Copy link
Collaborator

ruflin commented Jan 15, 2016

With tags you mean fields? Or is fields not sufficient and you need tags in addition?

@MiguelMoll
Copy link

Found this ticket while looking for a possible solution. Hopefully this is a good place. Would be great to have a list of "tags" along with key:value fields per prospector. Such as:

tags: [ "site2", "thistag", "thattag"]

@ruflin
Copy link
Collaborator

ruflin commented Jan 20, 2016

@MiguelMoll Can you briefly elaborate on how you use tags differently from fields. It is important for me to understand the use case.

@MiguelMoll
Copy link

Hard to answer exactly but going by how we've used tags in the past with logstash. It allows another avenue for filtering in Kibana.

If fields weren't strictly key:value where the value has to be a string also a list that would work too.

fields:
    level: debug
    tags: [ "site2", "thistag", "thattag"]

With fields_under_root and we'd be good to go.

The shipper uses tags nicely. But would be great to to make some tags prospector specific.

@ruflin
Copy link
Collaborator

ruflin commented Jan 21, 2016

If you put tags under fields this should already be possible in the upcoming 1.1 thanks to @magnusbaeck #506

@MiguelMoll
Copy link

Excellent news! Hopefully I didn't derail this ticket too much.

@ruflin
Copy link
Collaborator

ruflin commented Jan 21, 2016

The question is if the above would also solve the problem from @oazabir ?

@MiguelMoll Feel free to try the snapshots for 1.1. Links can be found in this post: https://discuss.elastic.co/t/insufficient-throughput-from-filebeat/39564/4

@andrewkroh andrewkroh added the Filebeat Filebeat label Mar 9, 2016
@ruflin
Copy link
Collaborator

ruflin commented Mar 15, 2016

Here is the generic tag / fields implementation @andrewkroh did: #1092 I think this resolves the above issues. Closing this issue, but happy to discuss further.

@ruflin ruflin closed this as completed Mar 15, 2016
@sunilmchaudhari
Copy link

Hi,
How can I create indexes on the basis of fields created in FB?
fields:
level: debug
tags: [ "site2", "thistag", "thattag"]
Application: "myapp"

So the index should be created as myap-YYYY-MM-DD

@ruflin
Copy link
Collaborator

ruflin commented May 2, 2016

@sunilmchaudhari This is currently only possible with Logstash. For questions please use https://discuss.elastic.co/c/beats/filebeat and not Github issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants