Comments (5)
Hi Brad,
First, a quick disclaimer: I'm not a Logstash guru by any means. 😕
I think there are two reasons why your config file isn't working:
- As far as I understand, the
if ... else ...
block can't go inside anelasticsearch
section. - I believe that
mutate
only works in afilter
section, so you can't use it to dynamically alterindex
anddocument_type
.
Again, not an expert so you may want to post your issue to the Logstash community to check what the "right" way to this would be, but the following config should work:
output {
if [@metadata][beat] =~ "filebeat-" {
elasticsearch {
hosts => ["localhost"]
sniffing => true
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
} else {
elasticsearch {
hosts => ["localhost"]
sniffing => true
manage_template => false
index => "other"
document_type => "stuff"
}
}
stdout {
codec => rubydebug
}
}
(I see that in https://discuss.elastic.co/t/how-to-handle-multiple-inputs-with-logstash-to-different-indices/24541 the name of the index is assigned using grok
at filter
time – might be worth a shot.)
from elk-docker.
Looks like it's done the job thanks. I'll update if I come across any downsides. I'll tidy up our implementation down the track if we add many more input types.
Is it worth pulling something similar into your image? I guess the same issue will crop up for anything using the lumberjack input?
from elk-docker.
OK cool, thanks.
The image has indeed been strongly biased towards Beats since Lumberjack was deprecated in favour of Filebeat. To keep things clean I probably won't be updating the image (each user's situation will be different, so accommodating the most common use case here), but I'll certainly add some words in the documentation to guide users in the right direction should they need to add support for a non-Beats shipper alongside Beats.
from elk-docker.
Turns out the above if
wasn't right. Here it is for completeness:
output {
if [@metadata][beat] {
elasticsearch {
hosts => ["localhost"]
sniffing => true
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
} else {
elasticsearch {
hosts => ["localhost"]
sniffing => true
manage_template => false
index => "other"
document_type => "stuff"
}
}
stdout {
codec => rubydebug
}
}
from elk-docker.
Nice one. Thanks for the update.
from elk-docker.
Related Issues (20)
- Can't get Elk started HOT 7
- cannot add login page to kibana HOT 1
- How to use environment variable in 30-output.conf file HOT 2
- ELK fails to start on MAC M1 HOT 8
- Setting up APM question HOT 4
- Question: user authentication for https HOT 1
- Error in Security section HOT 1
- Issues installing on TrueNAS Scale HOT 1
- Update ELK to latest version (currently 8.3.3) HOT 4
- Issues running on AWS Fargate HOT 2
- Add sample docker-compose.yml with persistance + traefik configuration HOT 1
- example using image never starts as elasticsearch doesn't start HOT 1
- Kibana refuses connection, nothing in logs HOT 2
- filebeat x509 certificate signed by unknown authority when calling api endpoint HOT 1
- Kibana enrollement token
- Update ELK to 8.9.0 HOT 1
- Kibana 8.11.1 Security Update (ESA-2023-25) HOT 1
- want to move data from this running stack to another machine (arm64-amd64) how to
- how to disable the features that require a licence.
- Please update to 8.13.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elk-docker.