Last active
July 15, 2016 06:53
-
-
Save xemoe/f344c1a8b0af2f8c8eb91cd98d6d4d77 to your computer and use it in GitHub Desktop.
SSH Files inputs
10-files-forward.conf
input {
file {
path => "/mnt/sshfs/mainbox/logs/syslog"
synced_path => "/opt/logstash/sincedb/mainbox.sincedb"
start_position => "beginning"
stat_interval => 1
tags => [mainbox_syslog]
type => "files_forward"
}
}
output {
if ([type] == "files_forward") {
if "mainbox_syslog" in [tags] {
file {
path => "/backup/forwardlogs/%{+YYYY-MM-dd}/syslog_172.100.0.200.log"
codec => {
line { format => "%{message}"}
}
}
}
}
}
10-files-forward.conf.j2
{% if item.logstash_inputs.file is defined and item.logstash_inputs.file | length > 0 %}
{% if item.logstash_outputs.file is defined and item.logstash_outputs.file | length > 0 %}
input {
file {
path => "{{ item.logstash_inputs.file.from_file }}"
synced_path => "{{ logstash_home }}/sincedb/{{ item.logstash_inputs.file.from_file | hash('sha1') }}.sincedb"
start_position => "beginning"
stat_interval => 1
tags => {{ item.logstash_inputs.file.tags | to_yaml }}
type => "{{ item.logstash_inputs.file.type | default("file_forward") }}"
}
}
output {
if ([type] == "{{ item.logstash_inputs.file.type }}") {
if "{{ item.file_tag }}" in [tags] {
file {
path => "{{ item.backup_directory }}/%{+YYYY-MM-dd}/{{ item.logstash_outputs.file.to_file }}"
codec => { line { format => "%{message}"} }
}
}
}
}
{% endif %}
{% endif %}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Logstash files forward configurations
Ref
https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html
https://www.elastic.co/guide/en/logstash/current/plugins-outputs-file.html
TODOs
/mnt/sshfs/mainbox/logs/syslog
mainbox_syslog
for file from/mnt/sshfs/mainbox/logs/syslog
/backup/forwardlogs/${DATE}/${FROMHOST}/${FILENAME}.${EXTENTIONS}
for tagmainbox_syslog