Ask Your Question

Need help with file_line match regex statement

asked 2015-12-14 11:40:58 -0600

rewurzb gravatar image

updated 2015-12-15 05:22:29 -0600

I have the following line in a file...

# /var/log/tomcat6/catalina.out

... which I wish to change to ...


... and my match statement isn't working. Here is my file_line statement...

    'Uncomment Tomcat6 log':
        path => '/etc/logrotate.conf',/var/log/tomcat6/catalina.out
        match => '^# /var/log/tomcat6/catalina.out.*$',
        line => '/var/log/tomcat6/catalina.out';

I've used this same syntax for other lines in other files, but not to remove characters, only append characters. I'm trying to remove the comment delimiter from the beginning of the line. The error I get is ...

"When providing a 'match' parameter, the value must be a reqex that matches against the value of your 'line' parameter."

The regex expression used with 'match" works if I use it with grep from the command line; it finds the line. So I'm thinking there is a problem with my "line" directive.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-12-15 05:36:46 -0600

Chutki gravatar image

I don't think file_line support uncomment line from file. Try using augeas provider please refer the url for more info

edit flag offensive delete link more

answered 2015-12-15 07:52:12 -0600

Are you having the same issue as documented in this thread?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-12-14 11:40:58 -0600

Seen: 1,443 times

Last updated: Dec 15 '15