I Want to push the log files data and get the files only if size greater than 1MB to Postgres using telegraf

[[inputs.tail]]

Log files to parse.

These accept standard unix glob matching rules, but with the addition of

** as a “super asterisk”. ie:

/var/log/**.log → recursively find all .log files in /var/log

/var/log//.log → find all .log files with a parent dir in /var/log

/var/log/apache.log → only tail the apache log file

files = [“C:\HISLogs\**.log”]

Read files that currently exist from the beginning. Files that are created

while telegraf is running (and that match the “files” globs) will always

be read from the beginning.

from_beginning = false

Method used to watch for file updates. Can be either “inotify” or “poll”.

watch_method = “poll”

Data format of the log file

#data_format = “grok”
#grok_patterns = [“%{TIMESTAMP_ISO8601:timestamp},%{DATA:module},%{INT:source},%{DATA:event_code},%{TIMESTAMP_ISO8601:event_timestamp},%{DATA:Workshop},%{DATA:device},%{DATA:FCS_info},%{DATA:tag},%{DATA:description}”]
data_format = “csv”
csv_column_names = [“TimeStart”, “Type”, “Value1”, “Value2”, “Value3”, “Timestamp”, “Location”, “Info”, “FCS”, “Tag”, “Value4”, “AlarmName”]
csv_delimiter = “,”
csv_comment = “”

get the files only if size greater than 1MB to Postgres using telegraf

You would need to use the exec plugin and write your own script to determine when a log file is greater than 1MB first, then send the metrics, or filter out smaller logs files before telegraf has a chance to read them.

Thanks for the information @jpowers