Filebeat read all logs, not only that one defined in configuration - spring-boot

I try to configure filebeat version 7.17.5 (amd64), libbeat 7.17.5, for reading Spring boot logs and sending them via logstash to elasticsearch. All works fine, logs are send and I can read it in Kibana but the problem is that I configured filebeat in file /etc/filebeat/filebeat.yml and defined there only one source of logs, but filebeat's still getting all logs from /var/log
It's my only one config for inputs:
filebeat.inputs:
- type: filestream
id: some_id
enabled: true
paths:
- "/var/log/dir_with_logs/application.log"
But when I check status of filebeat a have the information that:
[input] log/input.go:171 Configured paths: [/var/log/auth.log* /var/log/secure*]
And also I have logs from files: auth or secure in Kibana, which I don't want to have.
What I'm doing wrong or what I don't know what I should?

Based on the configured paths of /var/log/auth.log* and /var/log/secure*, I think this is the Filebeat system module. You can disable the system module by renaming /etc/filebeat/modules.d/system.yml to /etc/filebeat/modules.d/system.yml.disabled.
Alternatively you can run the filebeat modules command to disable the module (it simply renames the file for you).
filebeat modules disable system

Related

I keep seeing in Kibana logs from files that are not configured filebeat.yml

I'm a beginner in ELK.
I have Elasticsearch 8.5.3, Filebeat and Kibana all running on the same Windows machine.
In the filebeat.yml I have configured the following paths:
type: filestream
Unique ID among all inputs, an ID is required.
id: my-filestream-id
Change to true to enable this input configuration.
enabled: true
Paths that should be crawled and fetched. Glob based paths.
paths:
- C:\ProgramData\mycompany\Logs\specific.Log
I want Filebeat to ship data from that specific file only.
For some reason, no matter what I configure under paths
Filebeat ships data from all the log files in C:\ProgramData\mycompany\Logs.
Each time I change the paths to test something I restart Filebeat:
filebeat.exe -c C:\ProgramData\Elastic\Beats\filebeat\filebeat.yml
The path to the yml file is verified and correct.
Yet, the result is the same.
I see in Kibana the data and documents from all the files in that folder.
Filebeat is running in powershell and no errors there.
I tried to delete the Filebeat registry and it didn't help.
I also tried also to restart the elasticsearch, filebeat and kibana all together.
What am I missing here?

Filebeat Kubernetes cannot output to ElasticSearch

Filebeat Kubernetes cannot output to ElasticSearch,
ElasticSearch is OK.
filebeat is daemonset,relevant environment variables have been added.
filebeat.yml
filebeat.autodiscover:
providers:
- type: kubernetes
node: ${NODE_NAME}
hints.enabled: true
hints.default_config:
enabled: false
type: container
paths:
- /var/log/containers/*-${data.container.id}.log
output.elasticsearch:
hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
username: ${ELASTICSEARCH_USERNAME}
password: ${ELASTICSEARCH_PASSWORD}
Kubernetes
Use nginx app to test:
image=nginx:latest
Deployment annotations have been added.
co.elastic.logs/enabled: "true"
pod.yaml (in node1)
But cannot output to ElasticSearch,Logs and indexes for related input are not seen.
filebeat pod(node1) logs
Expect the filebeat to collect logs for the specified container(Pod) to elasticsearch.
#baymax first off, you don't need to explicitly define the property anywhere:
co.elastic.logs/enabled: "true"
since filebeat, by default, reads all the container log files on the node.
Secondly, you are disabling hints.default_config which ensures filebeat will only read the log files of pods which are annotated as above; however, you haven't provided any template config to be used for reading such log files.
For more info, read: https://www.elastic.co/guide/en/beats/filebeat/current/configuration-autodiscover-hints.html
Thirdly, in your filebeat logs, do you see any harvester being started, handles created and events published ? Posting a snapshot of logs doesn't give a clear picture. May be try starting filebeat in debug mode for few minutes and paste the logs here in proper formatting.

filebeat config changes on old log data

I have a small question regarding filebeat config. I have done the following changes:
from:
processors:
#- add_host_metadata: ~
to:
processors:
- add_host_metadata: ~
But this adds the fields only to the logs which are new and the old logs do not have host metadata fields. Is there any way in which we can achieve that. SO advised to delete registry but then the user was not able to get the logs (Resend old logs from filebeat to logstash) Is this even advisable?

Filebeat & test inputs

I'm working on a Filebeat solution and I'm having a problem setting up my configuration. Let me explain my setup:
I have a app that produces a csv file that contains data that I want to input in to ElasticSearch using Filebeats.
I'm using Filebeat 5.6.4 running on a windows machine.
Provided below is my filebeat.ymal configuration:
filebeat.inputs:
- type: log
enabled: true
paths:
- C:\App\fitbit-daily-activites-heart-rate-*.log
output.elasticsearch:
hosts: ["http://esldemo.com:9200"]
index: "fitbit-daily-activites-heartrate-%{+yyyy.MM.dd}"
setup.template:
name: "fitbit-daily-activites-heartrate"
pattern: "fitbit-daily-activites-heartrate-*"
fields: "fitbit-heartrate-fields.yml"
overwrite: false
settings:
index.number_of_shards: 1
index.number_of_replicas: 0
And my data looks like this:
0,2018-12-13 00:00:02.000,66.0,$
1,2018-12-13 00:00:07.000,66.0,$
2,2018-12-13 00:00:12.000,67.0,$
3,2018-12-13 00:00:17.000,67.0,$
4,2018-12-13 00:00:27.000,67.0,$
5,2018-12-13 00:00:37.000,66.0,$
6,2018-12-13 00:00:52.000,66.0,$
I'm trying to figure out why my configuration is not picking up my data and outputting it to ElasticSearch. Please help.
There are some differences in the way you configure Filebeat in versions 5.6.X and in the 6.X branch.
For 5.6.X you need to configure your input like this:
filebeat.prospectors:
- input_type: log
paths:
- 'C:/App/fitbit-daily-activites-heart-rate-*.log'
You also need to put your path between single quotes and use forward slashes.
Filebeat 5.6.X configuration

how to make filebeat pick up project-specific configuration file

I have the following yml file, in a project directory not the global file beat configuration directory:
filebeat:
idle_timeout: 5s
prospectors:
paths:
- "data-log/*"
output:
elasticsearch:
hosts: ["localhost:9200"]
Running filebeat -configtest produces no output.
Running filebeat produces no output either.
I would like the running filebeat daemon to dynamically pick up the configuration from this directory, assuming that the command filebeat should do that. I know this can be set up in the global config file, but I would rather perfrom this dynamically.
What am I doing wrong or what assumptions implied here are false?
try to strace filebeat process with
strace -fp {pid} -s 1024, the lines you should be looking for are stat({file_name}.
This way you will see if filebeat resolves path correctly.

Resources