-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
spurious field mapping errors in ES output #1134
Comments
Additionally: there are no log message from the fluent-bit pods themselves. Is this intentional? All other pods seem to work. |
We solved this by adding a Lua filter after the Kubernetes filter:
function dedot(tag, timestamp, record)
if record["kubernetes"] == nil then
return 0, 0, 0
end
dedot_keys(record["kubernetes"]["annotations"])
dedot_keys(record["kubernetes"]["labels"])
return 1, timestamp, record
end
function dedot_keys(map)
if map == nil then
return
end
for k, v in pairs(map) do
dedotted = string.gsub(k, "%.", "_")
if k ~= dedotted then
map[dedotted] = v
map[k] = nil
end
end
end It would be cool to have this support natively though. |
@andreykaipov Thanks for providing your script! When I use it, |
Hi @simonwh - we actually ran into it that yesterday too. It was working okay until a pod with no annotations or labels started running, which is rare enough I didn't think it was possible! I've edited my original post to add a nil check to |
@andreykaipov how can I reproduce the crash ? |
Hi @edsiper, the crash I was referring to isn't anything wrong with Fluent Bit. It was just my original Lua script not accounting for pods with an empty annotations or labels map.
|
Hi @andreykaipov I believe that your dedot function works fine, but for some reason my json annotations just partially transformed
I've tested function locally and it works properly. In fluent-bit configuration there are only 2 filters:
Do you have any clue, why that may happen? |
It seems that changing map during iteration is a bad idea |
Run into the same issue, the lua function does not seems to be working, i'm investigating. |
@mtparet I rewrote it into this
|
👍 please include a native dedot option in fluent-bit (and not only in ES plugin) |
@gmlexx Thanks a lot! worked here. @edsiper this lua script that @gmlexx / @andreykaipov made is very useful, could we create a kind of template and add in the code examples? https://github.com/fluent/fluent-bit/tree/master/scripts |
for now, we can add that script into our scripts directory, anyone wants to submit the PR? |
is there a workaround for this? The filter cannot be used as described above as Fluent-bit is installed via Helm. Containers look for scripts inside, of course there is no script.
I will be very appreciated if you can advise how to make it run on Kubernetes environment. |
k8s questions are a bit out of scope here. And it seems that you just don't know how to do it ;) You can simply mount a configMap with lua script and fluent-bit config. and load it in rawConfig chart value. There's few details from my own config here : |
But, we're still waiting to see dedot option to be included upstream :'( |
@BarthV I cannot say you're wrong ;) You helped me, I'm very appreciated. Thank you! |
thanks, worked! |
The lua script above doesn't work for me :(
|
FluentBit has an output ES config setting "Replace_Dots", will that solve the problem ? |
Fluent Bit v1.6.10 with Replace_Dots in ES output solved the problem for me without using Lua. |
What to do users which use s3 or Kafka as transport? Can anybody add Replace_Dots as a filter? |
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the |
This issue was closed because it has been stalled for 5 days with no activity. |
I used this too. slightly adjusted:
Labels are sometimes not parsed and it's pretty baffling me. I use k8s_ instead of kubernetes_ as prefix:
in this case just app.kubernetes.io/name is not parsed with underscores. so far this issue was one of the best finds about this topic yet. |
I was also facing the same issue, modified above mentioned lua script with some tweaks, one can find my solution here here Hope it helps |
Bug Report
Describe the bug
I see the error messages shown below in the log of my fluent-bit pods.
according to
kubectl get pods -l app --all-namespaces --show-labels
we only use values for theapp
label that match /[:alpha:][-:alphanum:]*[:alpha]/I have no idea where the app object is coming from.
Expected behavior
all fields of the
app
label to be unstructured strings.Your Environment
my config map is:
The text was updated successfully, but these errors were encountered: