blob: fddc48ec41dfd24e3f2bc3dc79239cf93ca1b3b3 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Apache Mesos: src/slave/container_loggers/logrotate.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Apache Mesos
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_80f0d4a0945c74dfa611dba2ec326a39.html">slave</a></li><li class="navelem"><a class="el" href="dir_579d88c8b070a2c745ef26d9577007a4.html">container_loggers</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">logrotate.hpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="logrotate_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">// Licensed to the Apache Software Foundation (ASF) under one</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">// or more contributor license agreements. See the NOTICE file</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">// distributed with this work for additional information</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">// regarding copyright ownership. The ASF licenses this file</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">// to you under the Apache License, Version 2.0 (the</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">// &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">// with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">// See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment">// limitations under the License.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#ifndef __SLAVE_CONTAINER_LOGGER_LOGROTATE_HPP__</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define __SLAVE_CONTAINER_LOGGER_LOGROTATE_HPP__</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#include &lt;stdio.h&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &lt;unistd.h&gt;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="bytes_8hpp.html">stout/bytes.hpp</a>&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="error_8hpp.html">stout/error.hpp</a>&gt;</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="3rdparty_2stout_2include_2stout_2flags_8hpp.html">stout/flags.hpp</a>&gt;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="option_8hpp.html">stout/option.hpp</a>&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="path_8hpp.html">stout/path.hpp</a>&gt;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="3rdparty_2stout_2include_2stout_2os_2constants_8hpp.html">stout/os/constants.hpp</a>&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="pagesize_8hpp.html">stout/os/pagesize.hpp</a>&gt;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="keyword">namespace </span>mesos {</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="keyword">namespace </span>internal {</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="keyword">namespace </span>logger {</div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html"> 36</a></span>&#160;<span class="keyword">namespace </span>rotate {</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;</div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#aee5dc359a1b6d22c5d912b166c895854"> 38</a></span>&#160;<span class="keyword">const</span> std::string <a class="code" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#aee5dc359a1b6d22c5d912b166c895854">NAME</a> = <span class="stringliteral">&quot;mesos-logrotate-logger&quot;</span>;</div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#a2ff732e40c6b4f02a02444462d5fc484"> 39</a></span>&#160;<span class="keyword">const</span> std::string <a class="code" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#a2ff732e40c6b4f02a02444462d5fc484">CONF_SUFFIX</a> = <span class="stringliteral">&quot;.logrotate.conf&quot;</span>;</div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#abf20cb8a71a943cda225a99bb81c26ed"> 40</a></span>&#160;<span class="keyword">const</span> std::string <a class="code" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#abf20cb8a71a943cda225a99bb81c26ed">STATE_SUFFIX</a> = <span class="stringliteral">&quot;.logrotate.state&quot;</span>;</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;</div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html"> 42</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html">Flags</a> : <span class="keyword">public</span> <span class="keyword">virtual</span> <a class="code" href="classflags_1_1FlagsBase.html">flags::FlagsBase</a></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;{</div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a908c2b7c0f5b04a8fb5b70f7833ba634"> 44</a></span>&#160; <a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a908c2b7c0f5b04a8fb5b70f7833ba634">Flags</a>()</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; {</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; <a class="code" href="classflags_1_1FlagsBase.html#ac99b7ca8863b671274472f571de0060a">setUsageMessage</a>(</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <span class="stringliteral">&quot;Usage: &quot;</span> + <a class="code" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#aee5dc359a1b6d22c5d912b166c895854">NAME</a> + <span class="stringliteral">&quot; [options]\n&quot;</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <span class="stringliteral">&quot;\n&quot;</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; <span class="stringliteral">&quot;This command pipes from STDIN to the given leading log file.\n&quot;</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="stringliteral">&quot;When the leading log file reaches &#39;--max_size&#39;, the command.\n&quot;</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; <span class="stringliteral">&quot;uses &#39;logrotate&#39; to rotate the logs. All &#39;logrotate&#39; options\n&quot;</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <span class="stringliteral">&quot;are supported. See &#39;--logrotate_options&#39;.\n&quot;</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; <span class="stringliteral">&quot;\n&quot;</span>);</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; <a class="code" href="classflags_1_1FlagsBase.html#a09ebe840242a3b0fbd3263bb6c7ca226">add</a>(&amp;<a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a9af79512a17ccbec175568aa7c6574ea">Flags::max_size</a>,</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; <span class="stringliteral">&quot;max_size&quot;</span>,</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <span class="stringliteral">&quot;Maximum size, in bytes, of a single log file.\n&quot;</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; <span class="stringliteral">&quot;Defaults to 10 MB. Must be at least 1 (memory) page.&quot;</span>,</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <a class="code" href="classMegabytes.html">Megabytes</a>(10),</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; [](<span class="keyword">const</span> <a class="code" href="classBytes.html">Bytes</a>&amp; value) -&gt; <a class="code" href="classOption.html">Option&lt;Error&gt;</a> {</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <span class="keywordflow">if</span> (value.<a class="code" href="classBytes.html#a1a2e9277ebe7d227a21f111898c49a8c">bytes</a>() &lt; <a class="code" href="namespaceos.html#af0898f40a19c3804347e30b9efa0984a">os::pagesize</a>()) {</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classError.html">Error</a>(</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; <span class="stringliteral">&quot;Expected --max_size of at least &quot;</span> +</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <a class="code" href="namespacens.html#a28116b46e6543597a11733424cd1aa20">stringify</a>(<a class="code" href="namespaceos.html#af0898f40a19c3804347e30b9efa0984a">os::pagesize</a>()) + <span class="stringliteral">&quot; bytes&quot;</span>);</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; }</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <span class="keywordflow">return</span> <a class="code" href="structNone.html">None</a>();</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; });</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <a class="code" href="classflags_1_1FlagsBase.html#a09ebe840242a3b0fbd3263bb6c7ca226">add</a>(&amp;<a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#ad8a1d00415b5c49cef8b620230a18c0a">Flags::logrotate_options</a>,</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="stringliteral">&quot;logrotate_options&quot;</span>,</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <span class="stringliteral">&quot;Additional config options to pass into &#39;logrotate&#39;.\n&quot;</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; <span class="stringliteral">&quot;This string will be inserted into a &#39;logrotate&#39; configuration file.\n&quot;</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <span class="stringliteral">&quot;i.e.\n&quot;</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <span class="stringliteral">&quot; /path/to/&lt;log_filename&gt; {\n&quot;</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="stringliteral">&quot; &lt;logrotate_options&gt;\n&quot;</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; <span class="stringliteral">&quot; size &lt;max_size&gt;\n&quot;</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="stringliteral">&quot; }\n&quot;</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <span class="stringliteral">&quot;NOTE: The &#39;size&#39; option will be overridden by this command.&quot;</span>);</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <a class="code" href="classflags_1_1FlagsBase.html#a09ebe840242a3b0fbd3263bb6c7ca226">add</a>(&amp;<a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#aa813ed8c26be59608ca5667c0c267f8b">Flags::log_filename</a>,</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <span class="stringliteral">&quot;log_filename&quot;</span>,</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; <span class="stringliteral">&quot;Absolute path to the leading log file.\n&quot;</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="stringliteral">&quot;NOTE: This command will also create two files by appending\n&quot;</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; <span class="stringliteral">&quot;&#39;&quot;</span> + <a class="code" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#a2ff732e40c6b4f02a02444462d5fc484">CONF_SUFFIX</a> + <span class="stringliteral">&quot;&#39; and &#39;&quot;</span> + <a class="code" href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#abf20cb8a71a943cda225a99bb81c26ed">STATE_SUFFIX</a> + <span class="stringliteral">&quot;&#39; to the end of\n&quot;</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="stringliteral">&quot;&#39;--log_filename&#39;. These files are used by &#39;logrotate&#39;.&quot;</span>,</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; [](<span class="keyword">const</span> <a class="code" href="classOption.html">Option&lt;std::string&gt;</a>&amp; value) -&gt; <a class="code" href="classOption.html">Option&lt;Error&gt;</a> {</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="keywordflow">if</span> (value.<a class="code" href="classOption.html#a06eab791122ebc1f8af4ad310e5e7d7e">isNone</a>()) {</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classError.html">Error</a>(<span class="stringliteral">&quot;Missing required option --log_filename&quot;</span>);</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; }</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <span class="keywordflow">if</span> (!<a class="code" href="namespacepath.html#a09c4941618b3a4ea2dbfccf5fe9d3687">path::absolute</a>(value.<a class="code" href="classOption.html#a21358442c0fac1cc978a67a9a9089a79">get</a>())) {</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classError.html">Error</a>(<span class="stringliteral">&quot;Expected --log_filename to be an absolute path&quot;</span>);</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; }</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; <span class="keywordflow">return</span> <a class="code" href="structNone.html">None</a>();</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; });</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; <a class="code" href="classflags_1_1FlagsBase.html#a09ebe840242a3b0fbd3263bb6c7ca226">add</a>(&amp;<a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a3e7f68e6e1128e2fb2fa4a84c58aa249">Flags::logrotate_path</a>,</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; <span class="stringliteral">&quot;logrotate_path&quot;</span>,</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <span class="stringliteral">&quot;If specified, this command will use the specified\n&quot;</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; <span class="stringliteral">&quot;&#39;logrotate&#39; instead of the system&#39;s &#39;logrotate&#39;.&quot;</span>,</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="stringliteral">&quot;logrotate&quot;</span>,</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; [](<span class="keyword">const</span> std::string&amp; value) -&gt; <a class="code" href="classOption.html">Option&lt;Error&gt;</a> {</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <span class="comment">// Check if `logrotate` exists via the help command.</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; <span class="comment">// TODO(josephw): Consider a more comprehensive check.</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; <a class="code" href="classTry.html">Try&lt;std::string&gt;</a> helpCommand =</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <a class="code" href="namespaceos.html#a0d86320d7799ea761599bc356c02a4fa">os::shell</a>(value + <span class="stringliteral">&quot; --help &gt; &quot;</span> + <a class="code" href="namespaceos.html#a8d90278daa51c4fe9fcb9e54757187b5">os::DEV_NULL</a>);</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160;</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="keywordflow">if</span> (helpCommand.<a class="code" href="classTry.html#a0b98f95163b8a38daafd1651b043a276">isError</a>()) {</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classError.html">Error</a>(</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; <span class="stringliteral">&quot;Failed to check logrotate: &quot;</span> + helpCommand.<a class="code" href="classTry.html#aec4a11ddd3c036e889d90b7eb6258ba7">error</a>());</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; }</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160;</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="keywordflow">return</span> <a class="code" href="structNone.html">None</a>();</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; });</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <a class="code" href="classflags_1_1FlagsBase.html#a09ebe840242a3b0fbd3263bb6c7ca226">add</a>(&amp;<a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a497482526f73fe8ee8249c28d49fd22f">Flags::user</a>,</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="stringliteral">&quot;user&quot;</span>,</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; <span class="stringliteral">&quot;The user this command should run as.&quot;</span>);</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; }</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;</div>
<div class="line"><a name="l00122"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a9af79512a17ccbec175568aa7c6574ea"> 122</a></span>&#160; <a class="code" href="classBytes.html">Bytes</a> <a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a9af79512a17ccbec175568aa7c6574ea">max_size</a>;</div>
<div class="line"><a name="l00123"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#ad8a1d00415b5c49cef8b620230a18c0a"> 123</a></span>&#160; <a class="code" href="classOption.html">Option&lt;std::string&gt;</a> <a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#ad8a1d00415b5c49cef8b620230a18c0a">logrotate_options</a>;</div>
<div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#aa813ed8c26be59608ca5667c0c267f8b"> 124</a></span>&#160; <a class="code" href="classOption.html">Option&lt;std::string&gt;</a> <a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#aa813ed8c26be59608ca5667c0c267f8b">log_filename</a>;</div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a3e7f68e6e1128e2fb2fa4a84c58aa249"> 125</a></span>&#160; std::string <a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a3e7f68e6e1128e2fb2fa4a84c58aa249">logrotate_path</a>;</div>
<div class="line"><a name="l00126"></a><span class="lineno"><a class="line" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a497482526f73fe8ee8249c28d49fd22f"> 126</a></span>&#160; <a class="code" href="classOption.html">Option&lt;std::string&gt;</a> <a class="code" href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a497482526f73fe8ee8249c28d49fd22f">user</a>;</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;};</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;} <span class="comment">// namespace rotate {</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;} <span class="comment">// namespace logger {</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;} <span class="comment">// namespace internal {</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;} <span class="comment">// namespace mesos {</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;<span class="preprocessor">#endif // __SLAVE_CONTAINER_LOGGER_LOGROTATE_HPP__</span></div>
<div class="ttc" id="classError_html"><div class="ttname"><a href="classError.html">Error</a></div><div class="ttdef"><b>Definition:</b> errorbase.hpp:35</div></div>
<div class="ttc" id="classOption_html"><div class="ttname"><a href="classOption.html">Option&lt; Error &gt;</a></div></div>
<div class="ttc" id="classTry_html"><div class="ttname"><a href="classTry.html">Try</a></div><div class="ttdef"><b>Definition:</b> try.hpp:34</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags_html"><div class="ttname"><a href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html">mesos::internal::logger::rotate::Flags</a></div><div class="ttdef"><b>Definition:</b> logrotate.hpp:42</div></div>
<div class="ttc" id="namespaceos_html_af0898f40a19c3804347e30b9efa0984a"><div class="ttname"><a href="namespaceos.html#af0898f40a19c3804347e30b9efa0984a">os::pagesize</a></div><div class="ttdeci">size_t pagesize()</div><div class="ttdef"><b>Definition:</b> pagesize.hpp:24</div></div>
<div class="ttc" id="namespacemesos_1_1internal_1_1logger_1_1rotate_html_abf20cb8a71a943cda225a99bb81c26ed"><div class="ttname"><a href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#abf20cb8a71a943cda225a99bb81c26ed">mesos::internal::logger::rotate::STATE_SUFFIX</a></div><div class="ttdeci">const std::string STATE_SUFFIX</div><div class="ttdef"><b>Definition:</b> logrotate.hpp:40</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags_html_a9af79512a17ccbec175568aa7c6574ea"><div class="ttname"><a href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a9af79512a17ccbec175568aa7c6574ea">mesos::internal::logger::rotate::Flags::max_size</a></div><div class="ttdeci">Bytes max_size</div><div class="ttdef"><b>Definition:</b> logrotate.hpp:122</div></div>
<div class="ttc" id="namespacemesos_1_1internal_1_1logger_1_1rotate_html_aee5dc359a1b6d22c5d912b166c895854"><div class="ttname"><a href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#aee5dc359a1b6d22c5d912b166c895854">mesos::internal::logger::rotate::NAME</a></div><div class="ttdeci">const std::string NAME</div><div class="ttdef"><b>Definition:</b> logrotate.hpp:38</div></div>
<div class="ttc" id="namespacemesos_1_1internal_1_1logger_1_1rotate_html_a2ff732e40c6b4f02a02444462d5fc484"><div class="ttname"><a href="namespacemesos_1_1internal_1_1logger_1_1rotate.html#a2ff732e40c6b4f02a02444462d5fc484">mesos::internal::logger::rotate::CONF_SUFFIX</a></div><div class="ttdeci">const std::string CONF_SUFFIX</div><div class="ttdef"><b>Definition:</b> logrotate.hpp:39</div></div>
<div class="ttc" id="namespacepath_html_a09c4941618b3a4ea2dbfccf5fe9d3687"><div class="ttname"><a href="namespacepath.html#a09c4941618b3a4ea2dbfccf5fe9d3687">path::absolute</a></div><div class="ttdeci">bool absolute(const std::string &amp;path)</div><div class="ttdef"><b>Definition:</b> path.hpp:65</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags_html_a497482526f73fe8ee8249c28d49fd22f"><div class="ttname"><a href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a497482526f73fe8ee8249c28d49fd22f">mesos::internal::logger::rotate::Flags::user</a></div><div class="ttdeci">Option&lt; std::string &gt; user</div><div class="ttdef"><b>Definition:</b> logrotate.hpp:126</div></div>
<div class="ttc" id="bytes_8hpp_html"><div class="ttname"><a href="bytes_8hpp.html">bytes.hpp</a></div></div>
<div class="ttc" id="path_8hpp_html"><div class="ttname"><a href="path_8hpp.html">path.hpp</a></div></div>
<div class="ttc" id="classMegabytes_html"><div class="ttname"><a href="classMegabytes.html">Megabytes</a></div><div class="ttdef"><b>Definition:</b> bytes.hpp:131</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags_html_a3e7f68e6e1128e2fb2fa4a84c58aa249"><div class="ttname"><a href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a3e7f68e6e1128e2fb2fa4a84c58aa249">mesos::internal::logger::rotate::Flags::logrotate_path</a></div><div class="ttdeci">std::string logrotate_path</div><div class="ttdef"><b>Definition:</b> logrotate.hpp:125</div></div>
<div class="ttc" id="classflags_1_1FlagsBase_html"><div class="ttname"><a href="classflags_1_1FlagsBase.html">flags::FlagsBase</a></div><div class="ttdef"><b>Definition:</b> flags.hpp:44</div></div>
<div class="ttc" id="classflags_1_1FlagsBase_html_ac99b7ca8863b671274472f571de0060a"><div class="ttname"><a href="classflags_1_1FlagsBase.html#ac99b7ca8863b671274472f571de0060a">flags::FlagsBase::setUsageMessage</a></div><div class="ttdeci">void setUsageMessage(const std::string &amp;message)</div><div class="ttdef"><b>Definition:</b> flags.hpp:164</div></div>
<div class="ttc" id="3rdparty_2stout_2include_2stout_2flags_8hpp_html"><div class="ttname"><a href="3rdparty_2stout_2include_2stout_2flags_8hpp.html">flags.hpp</a></div></div>
<div class="ttc" id="classOption_html_a21358442c0fac1cc978a67a9a9089a79"><div class="ttname"><a href="classOption.html#a21358442c0fac1cc978a67a9a9089a79">Option::get</a></div><div class="ttdeci">const T &amp; get() const &amp;</div><div class="ttdef"><b>Definition:</b> option.hpp:111</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags_html_a908c2b7c0f5b04a8fb5b70f7833ba634"><div class="ttname"><a href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#a908c2b7c0f5b04a8fb5b70f7833ba634">mesos::internal::logger::rotate::Flags::Flags</a></div><div class="ttdeci">Flags()</div><div class="ttdef"><b>Definition:</b> logrotate.hpp:44</div></div>
<div class="ttc" id="option_8hpp_html"><div class="ttname"><a href="option_8hpp.html">option.hpp</a></div></div>
<div class="ttc" id="classTry_html_aec4a11ddd3c036e889d90b7eb6258ba7"><div class="ttname"><a href="classTry.html#aec4a11ddd3c036e889d90b7eb6258ba7">Try::error</a></div><div class="ttdeci">static Try error(const E &amp;e)</div><div class="ttdef"><b>Definition:</b> try.hpp:42</div></div>
<div class="ttc" id="pagesize_8hpp_html"><div class="ttname"><a href="pagesize_8hpp.html">pagesize.hpp</a></div></div>
<div class="ttc" id="namespaceos_html_a0d86320d7799ea761599bc356c02a4fa"><div class="ttname"><a href="namespaceos.html#a0d86320d7799ea761599bc356c02a4fa">os::shell</a></div><div class="ttdeci">Try&lt; std::string &gt; shell(const std::string &amp;fmt, const T &amp;...t)</div><div class="ttdoc">Runs a shell command with optional arguments. </div><div class="ttdef"><b>Definition:</b> shell.hpp:71</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags_html_aa813ed8c26be59608ca5667c0c267f8b"><div class="ttname"><a href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#aa813ed8c26be59608ca5667c0c267f8b">mesos::internal::logger::rotate::Flags::log_filename</a></div><div class="ttdeci">Option&lt; std::string &gt; log_filename</div><div class="ttdef"><b>Definition:</b> logrotate.hpp:124</div></div>
<div class="ttc" id="error_8hpp_html"><div class="ttname"><a href="error_8hpp.html">error.hpp</a></div></div>
<div class="ttc" id="structNone_html"><div class="ttname"><a href="structNone.html">None</a></div><div class="ttdef"><b>Definition:</b> none.hpp:27</div></div>
<div class="ttc" id="classTry_html_a0b98f95163b8a38daafd1651b043a276"><div class="ttname"><a href="classTry.html#a0b98f95163b8a38daafd1651b043a276">Try::isError</a></div><div class="ttdeci">bool isError() const </div><div class="ttdef"><b>Definition:</b> try.hpp:71</div></div>
<div class="ttc" id="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags_html_ad8a1d00415b5c49cef8b620230a18c0a"><div class="ttname"><a href="structmesos_1_1internal_1_1logger_1_1rotate_1_1Flags.html#ad8a1d00415b5c49cef8b620230a18c0a">mesos::internal::logger::rotate::Flags::logrotate_options</a></div><div class="ttdeci">Option&lt; std::string &gt; logrotate_options</div><div class="ttdef"><b>Definition:</b> logrotate.hpp:123</div></div>
<div class="ttc" id="namespaceos_html_a8d90278daa51c4fe9fcb9e54757187b5"><div class="ttname"><a href="namespaceos.html#a8d90278daa51c4fe9fcb9e54757187b5">os::DEV_NULL</a></div><div class="ttdeci">constexpr char DEV_NULL[]</div><div class="ttdef"><b>Definition:</b> constants.hpp:30</div></div>
<div class="ttc" id="classBytes_html_a1a2e9277ebe7d227a21f111898c49a8c"><div class="ttname"><a href="classBytes.html#a1a2e9277ebe7d227a21f111898c49a8c">Bytes::bytes</a></div><div class="ttdeci">uint64_t bytes() const </div><div class="ttdef"><b>Definition:</b> bytes.hpp:75</div></div>
<div class="ttc" id="classflags_1_1FlagsBase_html_a09ebe840242a3b0fbd3263bb6c7ca226"><div class="ttname"><a href="classflags_1_1FlagsBase.html#a09ebe840242a3b0fbd3263bb6c7ca226">flags::FlagsBase::add</a></div><div class="ttdeci">void add(T1 Flags::*t1, const Name &amp;name, const Option&lt; Name &gt; &amp;alias, const std::string &amp;help, const T2 *t2, F validate)</div><div class="ttdef"><b>Definition:</b> flags.hpp:333</div></div>
<div class="ttc" id="classOption_html_a06eab791122ebc1f8af4ad310e5e7d7e"><div class="ttname"><a href="classOption.html#a06eab791122ebc1f8af4ad310e5e7d7e">Option::isNone</a></div><div class="ttdeci">bool isNone() const </div><div class="ttdef"><b>Definition:</b> option.hpp:109</div></div>
<div class="ttc" id="classBytes_html"><div class="ttname"><a href="classBytes.html">Bytes</a></div><div class="ttdef"><b>Definition:</b> bytes.hpp:30</div></div>
<div class="ttc" id="namespacens_html_a28116b46e6543597a11733424cd1aa20"><div class="ttname"><a href="namespacens.html#a28116b46e6543597a11733424cd1aa20">ns::stringify</a></div><div class="ttdeci">std::string stringify(int flags)</div><div class="ttdef"><b>Definition:</b> ns.hpp:688</div></div>
<div class="ttc" id="3rdparty_2stout_2include_2stout_2os_2constants_8hpp_html"><div class="ttname"><a href="3rdparty_2stout_2include_2stout_2os_2constants_8hpp.html">constants.hpp</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>