Capturing entry from /var/log/messages

I have a large /var/log/messages file which gets rotated. I would like to get log entries which only have
‘rsyslogd was HUpped’ and put them into telegraf.

How would I achieve this?

I would recommend using filtering rules in rsyslog.conf (or rsyslog.d/*)

Antony.

I don’t have access to syslog (rsyslog) config. I only have access to /var/log/messages.
Besides, /var/log/messages, I have other similar log files I need to apply something similar. How can I do that?

Does anyone have an idea?

If I understand your post correctly you only want logs of a certain content!? The Telegraf way would be to first convert all lines into metrics and then use metric-filtering. Alternatively you could setup an inputs.exec command that filters out the interesting lines e.g. via grep…