Ask Your Question
0

Need help with file_line match regex statement

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

rewurzb gravatar image

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

I have the following line in a file...

# /var/log/tomcat6/catalina.out

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

/var/log/tomcat6/catalina.out

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

file_line
{
    '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
0

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

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 http://augeasproviders.com/documentat...

edit flag offensive delete link more
0

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

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

Stats

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

Seen: 719 times

Last updated: Dec 15 '15