Friday 9 February 2018

Logrotate - copytruncate - बाइनरी - विकल्प


Logrotate. Log फ़ाइलों के साथ लिनक्स लॉग फाइलों का प्रबंधन लिनक्स सिस्टम सुरक्षा के लिए उपलब्ध सबसे बहुमूल्य उपकरण हैं लॉग्रोटेट प्रोग्राम का प्रयोग प्रशासकों को सिस्टम पर होने वाली घटनाओं का अप-टू-डेट रिकॉर्ड प्रदान करने के लिए किया जाता है Logrotate उपयोगिता का भी उपयोग किया जा सकता है लॉग फाइलों का बैक अप लेने के लिए, इसलिए प्रतियों का उपयोग सिस्टम उपयोग के लिए पैटर्न स्थापित करने के लिए किया जा सकता है इस दैनिक ड्रिल डाउन में, मैं निम्नलिखित विषयों को कवर करूंगा। लॉग्रोटेट कॉन्फ़िगरेशन। लॉग्रोटेट के लिए डिफ़ॉल्ट सेट करना। अन्य कॉन्फ़िगरेशन फ़ाइलों को पढ़ने के लिए विकल्प शामिल करना। विशिष्ट फाइलों के लिए रोटेशन मापदंडों का उपयोग करें। लॉग-लोट प्रोग्राम लॉग-लोट प्रोग्राम एक लॉग फाइल मैनेजर है इसे नियमित रूप से चक्र या अपने सिस्टम से सबसे पुराना लोगों को निकाल कर और नई लॉग फाइल बनाने के द्वारा लॉग फाइलों को घुमाने के लिए उपयोग किया जाता है फ़ाइल या फ़ाइल आकार की उम्र के आधार पर घूमने के लिए इस्तेमाल किया जाता है, और आमतौर पर क्रॉन उपयोगिता के माध्यम से स्वचालित रूप से चलाता है लॉग्रोटेट प्रोग्राम का उपयोग लॉग फ़ाइल संक्षिप्त करने के लिए भी किया जा सकता है s और उपयोगकर्ताओं को ई-मेल को कॉन्फ़िगर करने के लिए जब वे घुमाए जाते हैं। लॉग्रोटेट कॉन्फ़िगरेशन फ़ाइल में विकल्प डालने के द्वारा लॉगरोटेट प्रोग्राम को कॉन्फ़िगर किया गया है यह एक पाठ फ़ाइल है, जिसमें तालिका में सूचीबद्ध किसी भी विन्यास विकल्प शामिल हो सकते हैं में सिस्टम पर किसी भी लॉग फ़ाइल के लिए कॉन्फ़िगरेशन पैरामीटर सेट करने के लिए इस्तेमाल किया जा सकता है ये विकल्प भी लॉर्रोटेट को अन्य लॉग फाइलों से कॉन्फ़िगरेशन पैरामीटर को पढ़ने के लिए शामिल करने के लिए उपयोग किया जा सकता है। इसमें शामिल पैरामीटर का उपयोग करके। यह रोटेट किए गए लॉग फ़ाइल को gzip यह प्रयोग किया जाता है जब आप घुमाए गए लॉग फाइलों को सम्मिलित नहीं करना चाहते हैं। इसका उपयोग तब किया जाता है जब प्रक्रियाएं अभी भी लॉग फाइल खोलने के लिए सूचना लिख ​​रही हैं यह विकल्प बैकअप में सक्रिय लॉग फ़ाइल की प्रतिलिपि बनाता है और सक्रिय लॉग फ़ाइल को छोटा करता है। यह लॉग फाइल की प्रतिलिपि बनाता है बैकअप के लिए, लेकिन खुली लॉग फ़ाइल को छोटा नहीं किया जाता है। विन्ड मोड स्वामी समूह। यह लॉग फ़ाइल घुमाता है और निर्दिष्ट अनुमतियों, मालिक और समूह के साथ एक नई लॉग फ़ाइल बनाता है डिफ़ॉल्ट रूप से उसी मी ओडी, मालिक और मूल फ़ाइल के रूप में समूह। यह एक नई लॉग फ़ाइल के निर्माण को रोकता है। जब सेकेंड ऑप्शन के साथ प्रयोग किया जाता है, तो घुमाए गए लॉग फ़ाइल को अगली बार जब तक साइक्लेड नहीं किया जाता है तब तक संकुचित नहीं होता है। यह delaycompress को ओवरराइड करता है लॉग फ़ाइल है जब इसे साइक्लेड किया जाता है तो संकुचित हो जाता है। यदि 2 जीबी का आकार, टमाटर क्रैश हो जाता है और बिना किसी त्रुटि संदेश के शुरू होने में विफल रहता है, इस परिदृश्य से बचने के लिए आपको अक्सर घुमाए जाने चाहिए यह आलेख वर्णन करता है कि कैसे लिनक्स यूनिक्स मशीन पर ऑटो रोटेशन को सेट करना। या जब यह 5 एम 2 से बड़ा हो जाता है, तो निम्न सामग्री को उपरोक्त फ़ाइल में प्रतिलिपि बनाएँ। ऊपर दिए गए कॉन्फ़िगरेशन के बारे में। सुनिश्चित करें कि ऊपर का रास्ता आपके टॉमक के लिए इंगित किया गया है। दैनिक - रोज़रेट को घुमाता है। रोटेट अधिकतम 7 लॉग filespress घुमाए गए फ़ाइलों को संपीड़ित करता है। स्पीड rotates अगर आकार 5M. copytruncate से बड़ा होता है, तो एक पुरानी लॉग फ़ाइल को ले जाने और वैकल्पिक रूप से एक नया बनाने के बजाय, प्रतिलिपि बनाने के बाद मूल लॉग फ़ाइल को मिटा दिया जाता है, इसका इस्तेमाल किया जा सकता है जब कुछ प्रोग्राम को इसके लॉगफाइल को बंद करने के लिए नहीं कहा जा सकता है और इस तरह से हमेशा के लिए पिछले लॉग फाइल में संलग्न लेखन जारी रख सकते हैं नोट करें कि फ़ाइल की प्रतिलिपि बनाने और इसे छूने के बीच बहुत कम समय का टुकड़ा है, इसलिए कुछ लॉगिंग डेटा खो सकता है जब यह विकल्प उपयोग किया जाता है, बनाओ विकल्प का कोई असर नहीं होगा, क्योंकि पुरानी लॉग फ़ाइल जगह में रहता है। आपको कुछ और करने की ज़रूरत नहीं है। यह कैसे काम करता है। हर रात क्रॉन डेमॉन निर्देशिका में सूचीबद्ध कार्य चलाता है। यह फ़ाइल को चालू करता है आम तौर पर लिनक्स अधिष्ठापन के साथ भेज दिया जाता है यह कमांड usr sbin logrotate चलाता है। आदि logrotate d निर्देशिका में सभी लिपियों को शामिल करता है। यह आपके द्वारा पिछले चरण में लिखा गया logrotate d tomcat फ़ाइल को चालू करता है। Run logrotate मैन्युअल रूप से। निम्न कमांड को चलाने के लिए क्रोन जॉब को मैन्युअल रूप से चलाएं। यह पूरी तरह से सुरक्षित है। ऊपर प्रतिलिपि कटौती विधि का विवरण देखें प्रतिलिपि और छांट के कदमों के बीच लॉगिंग डेटा हानि की थोड़ी सी संभावना है, आमतौर पर यह स्वीकार्य है लेकिन कभी-कभी इसकी नहीं। अधिक लॉबर्टेट विकल्प। अपने सिस्टम पर सभी लॉग-टोट विकल्पों को देखने के लिए, मैनुअल देखें। स्टीव द्वारा दिनांक 29 मार्च 2005 06 में पोस्ट किया गया। कई लिनक्स मशीनों पर स्थापित सेवाओं में लॉगफ़ाइलें उत्पन्न होती हैं जो बढ़ते हैं, और बढ़ते हैं, और बढ़ो यदि अनचेक छोड़ा जाए तो आप आसानी से लॉबफाइल के बड़े संग्रह के साथ एक डिस्क भर सकते हैं यदि आप सावधान नहीं रखते हैं। लॉगफ़ाइल वृद्धि को जांचने की सबसे सामान्य विधि लॉगोटेट का उपयोग करना है और कई डेबियन पैकेज डिफ़ॉल्ट रूप से इसके साथ काम करने के लिए सेटअप हैं। सबसे स्पष्ट पैकेज जो इसका उपयोग करता है वह अपाचे, वेबसर्वर है, जो डिफ़ॉल्ट रूप से डायरेक्ट्री वेर लॉग अपाचे या var लॉग अपाचे 2 में लॉगफ़ाइल रखता है। यदि आप इस निर्देशिका की जांच करते हैं तो आप देखेंगे कि वहाँ लॉगफ़ाइलों का संग्रह है जो संग्रहीत हैं। वर्तमान लॉगफ़ाइलों को कच्चे रखा जाता है जैसे कि कल की लॉगफ़ाइलें और पिछली लॉगफ़ाइलें gzip के साथ संकुचित होती हैं और केवल पांच सप्ताह के लिए रखी जाती हैं मुझे पता है कि यह पांच सप्ताह है और पांच दिन नहीं है क्योंकि मैंने विन्यास को देखा है - हालांकि यह इस आउटपुट से स्पष्ट नहीं है। गु ई प्रक्रिया जो इन लॉगफाइलों को संपीड़ित और घूर्णन करने के प्रभार में होती है उन्हें लॉग्रोटेट कहा जाता है और इसे डेबियन इंस्टॉलेशन पर प्रति दिन एक बार निष्पादित किया जाता है। जैसा कि हमने देखा था जब हम क्रॉन के साथ कमांडिंग कमांडिंग की तलाश कर रहे थे, तब एक डायरेक्टरी कहा जाता है जिसमें लिपियों को एक बार क्रियान्वित किया जाता है प्रतिदिन यहां आपको लॉगरोटेट ड्रायवर स्क्रिप्ट मिल जाएगी। हर रोज यह स्क्रिप्ट दो चीजों की जांच करती है और जांचती है। कॉन्फ़िगरेशन फ़ाइल। कॉन्फ़िगरेशन डाइरेक्टरी इत्यादि लॉग्रोटेट डी। बाद में वह है जहां हमारे ज्यादातर पैकेज कॉन्फ़िगर किए गए हैं यह डायरेक्टरी में कॉन्फ़िगरेशन फाइलें हैं जो अन्य पैकेज स्थापित किया है उदाहरण के लिए यदि आप apache को स्थापित करते हैं तो फ़ाइल आदि logrotate d apache स्थापित हो जाएगा। कई सर्वर जैसे कि exim मेलसेवर अपनी स्वयं की कॉन्फ़िगरेशन फ़ाइल स्थापित करेगा, और आप अपना स्वयं जोड़ सकते हैं.एक ठेठ लॉग्रोटेट कॉन्फ़िगरेशन फ़ाइल इस तरह दिखती है। यहाँ कई महत्वपूर्ण चीजें देखें सबसे स्पष्ट है कि फाइलों की सूची है जो इस कॉन्फ़िगरेशन फ़ाइल से मेल खाएगी.इसके बाद हमारे पास एक कोल कॉन्फ़िगरेशन के नियम, प्रत्येक पंक्ति पर एक अलग-अलग वाक्य, हमारे ऊपर दिए गए उदाहरण में। फाइलें हर हफ्ते घुमाए जाने चाहिए। रोज़ का विरोध करें। हमें जीएनआईपी के साथ पुरानी फाइलों को नसीब नहीं करना चाहिए। अगर लॉगफ़ाइल खाली है, तो किसी भी रोटेशन को मत करो। यदि आप को नई फ़ाइल बनाने के लिए उसे दिया गया मोड, मालिक और समूह देना होगा। यदि प्रत्येक लॉगफाइल के लिए किसी भी पूर्वरेखा या पोस्टरोट स्क्रिप्ट को अलग-अलग चलाएं तो विरोध करें nosharedscripts. postrotate endcript। इन के बीच किसी भी चीज को रोटेशन प्रक्रिया के बाद निष्पादित किया जाता है विपरीत पक्षपात। आशा है कि इसे समझना चाहिए। इस स्क्रिप्ट का नतीजा यह है कि किसी भी फ़ाइल को हर सप्ताह सेकेंड में घुमाया जाता है, अगर यह खाली नहीं है तो नया फ़ाइल को 640 के फ़ाइल मोड के साथ बनाया गया है, और रोटेशन समाप्त हो जाने के बाद सर्वर को पुनरारंभ किया गया है। अगर हम एक स्थानीय सेवा स्थापित करना चाहते हैं जो एक लॉगफ़ाइल बनाता है तो हम इसे बहुत आसानी से घुमाया जा सकता है, सिर्फ एक नया लॉग्रोटेट कॉन्फ़िगरेशन फ़ाइल जोड़कर. आदकन कि हमारे पास एक नया सर्विस फ़्रेड है जो इसके आउटपुट का उत्पादन करता है, हम इसे हर तरह से इस तरह की स्क्रिप्ट के साथ घुमाया जा सकता है। किसी एक समय में 7 दिनों से ज्यादा लॉगफ़ाइल नहीं रखें। अगर कोई लॉगफ़ाइल पुरानी फाइलों में ग़लती हुई है, लेकिन शिकायत नहीं कीजिए, तो कल नहीं। उपयोगकर्ता और समूह फ़्रेड के स्वामित्व के रूप में नई लॉगफ़ाइल बनाएं। लॉगफ़ाइल घूमने के बाद सेवा को पुन: प्रारंभ करें। लॉग्रोटेट निर्देशिका में मौजूदा फ़ाइलों में से कोई भी जांच की जा सकती है अधिक उदाहरणों के लिए और मेनपेप दस्तावेज़ों को स्पष्ट रूप से उपयोग किए जा सकने वाले सभी विकल्प हैं। पुनः पीएफएफ फाइलें घुमाएगी। अनामित द्वारा बुधवार 10 फरवरी 2010 को 00 पर पोस्ट किया गया था। मुझे विश्वास है कि लॉग -ोटेट ठीक काम नहीं कर रहा है जब तक कि फ़ाइलें खोले नहीं हैं ऐंडेंड मोड में rhel-as4 मेरे मामले में, जब खोला खोला सेवा को एक फ़ाइल सूचक रखता है और रोटेशन से पहले के रूप में एक ही ऑफ़सेट पर लेखन शुरू होता है, और पूर्ववर्ती पाठ को कचरा बंद कर दिया जाएगा और फिर से खोलना, पुनरारंभ करनासेवा या फ़ाइल संलग्नक के साथ खोलने या सभी के साथ काम करने लगते हैं। मेरे मामले में, मैं कार्य को पुनरारंभ नहीं कर सका क्योंकि यह मेरे लिए काम करने वाला एक एचडीएचआर के लिए मैनेजर था। पुनः पीएफएफ फाइलें रोटेट नहीं करती हैं। अज्ञात पर 4 अक्टूबर 2011 को 20 28. अरे, मुझे एक ही समस्या हुई है कुछ गुगलिंग के बाद और कोशिश करते हुए मुझे इसका जवाब मिल गया। आप को आसानी से सेटिंग्स को कॉपी करने की आवश्यकता है, सब कुछ. बैकगर समस्या यह है, कि लॉग -ोटेट घुमाए जाने के बाद लॉगफ़ाइल, सूचक अभी भी फाइल पर है - लेकिन अब इसे नाम दिया गया है और एपाचे उस फ़ाइल में लॉग इन करने की कोशिश करता है - नए बनाए गए एक में नहीं। वेबसाइट जिसने मेरी मदद करने के लिए बिंदु 3. बाहर निकलते हैं। लॉग लॉग के साथ लॉगफ़ाइल अभिलेखागार बनाना । Gmicah द्वारा पोस्ट किया गया सोम 22 अगस्त 2005 12 12. मैं कुछ syslog संदेशों पर लॉगिंग की स्थापना कर रहा हूँ जो मैं अलग-अलग बक्से से प्राप्त कर रहा हूं लॉग्स को घुमाए जाने का सबसे आसान तरीका क्या है, निर्देशिका के भीतर सभी निर्देशिकाएं। फिर से लॉगफ़ाइल बनाना लॉग्रोटेट के साथ अभिलेखागार। निलंबित उपयोगकर्ता gg234 द्वारा पोस्ट किया गया सोम 17 अक्तूबर 2005 को 11 26 में। मैं अपने लॉग्रोटेट कॉन्फ़िगरेशन फ़ाइल को निम्न प्रकार से कॉन्फ़िगर करना चाहता हूं। हमें सभी लॉग को लॉग करने के लिए सभी लॉग्स को लॉग करना आवश्यक है। इस फोल्डर के अंतर्गत हमारे पास अलग-अलग क्लाइंट डायरेक्टरी में लॉगफ़ाइलें होनी चाहिए और इसके लिए फाइलें होनी चाहिए प्रत्येक महीने के अंत में लॉग्रॉट चलाना चाहिए और इसे फाइल के साथ monthnameandyear फ़ोल्डर में लॉग फ़ाइलों को रखना चाहिए। इस फ़ोल्डर के अंतर्गत इन in. logfiles स्थान var लॉग apache2 लॉग को कॉन्फ़िगर करने के लिए प्रत्येक ग्राहक के पास लॉग के लिए उनके फ़ोल्डिंग हैं जो कि अपाचे लॉग फाइल हैं मैं ई। हर महीने लॉस्ट्रोट चलाना चाहिए और इसे महीने के नाम के साथ एक फ़ोल्डर बनाना चाहिए इस महीना के नाम के तहत फ़ोल्डर जो सतर्क माह लॉगफ़ाइल फ़ाइल शोर हो। फिर से logfot के साथ लॉगफ़ाइल अभिलेखागार बनाते हैं। अज्ञात द्वारा शुक्रवार 8 सितंबर 2006 को 04 बजे 10। एक तरीका या तरीके की तलाश - सोरी, मेरी अंग्रेजी बहुत अच्छी नहीं है - घुड़सवार लॉग को लगाव के रूप में मेल करें, न कि संदेश के मुख्य भाग में, वास्तव में, लॉग को घुमाने की कोशिश कर रहा है, लेकिन एक ओपनऑफ़िस बैकअप कारणों के लिए फ़ाइल यह एक गैर-सामान्य गतिविधि हो सकती है, लेकिन आईडी ऐसा करना पसंद है दुर्भाग्य से, लॉग्रोटेट का मेल विकल्प उस फ़ाइल के सादे पाठ में फ़ाइल भेजता है जिसे मैं संलग्न फ़ाइल की तरह भेजना चाहता हूं। धन्यवाद logrotate के साथ लॉगफ़ाइल अभिलेखागार बनाना। पुन: अज्ञात द्वारा शुक्रवार 10 नवम्बर, 2006 को 02 02 पर पोस्ट किया गया। लॉग्रोटेट के साथ लॉगफ़ाइल अभिलेखागार बनाते हैं। रवि 31 दिसंबर 2006 को 18 अप्रैल को पोस्ट किया गया था। मुझे उम्मीद है कि कोई मुझे निम्नलिखित के साथ मदद कर सकता है.मैं आभासी एपाचे 2 का प्रयोग कर रहा हूं, जो अपने स्वयं के अभिगम लॉग फाइलों में से प्रत्येक को मेजबान करता है, मैंने लॉग-इन में प्रत्येक मेजबान के लिए अलग-अलग लॉग्रोटेट फाइल बनाई हैं। मुझे जो अनुभव है वो है कि मेरी लॉग फाइल घुमाए जा रही है, लेकिन अपाचे पुराने लॉगफाइल में प्रवेश करता है जैसे कि अपाचे फिर से शुरू नहीं किया गया है लेकिन अगर मेरे पास पीट्रोटेट है तो - f फिर आदि init d apache2 restart dev null fi endcript. कोई किसी के पास ऐप्पैक को नई फाइल में लॉगिंग कैसे करना है, इस पर एक सुराग है। फिर से logrotate के साथ लॉगफाइल अभिलेखागार बनाते हैं। कॉमरेडपी द्वारा सूर्य पर पोस्ट किया गया 8 अप्रैल 2007 10 पर 03.क्या आपने तय किया था इस समस्या में मेरे पास वही समस्या है, और लॉग-लोटेट ने सही फ़ाइल में प्रवेश करने के लिए लॉग-टोट के लिए किया है, फिर मैन्युअल रूप से अपाचे को पुनरारंभ करना होगा। मैं गलत हो सकता है, लेकिन मुझे लगता है कि यह केवल तब से हो रहा है जब मैंने शुरू किया एक संभावित रूप से बल्कि महंगा पूर्व-रोटेट कार्य। लॉग्रोटेट के साथ लॉगफ़ाइल अभिलेखागार बनाते हैं। बॉट द्वारा सूर्य पर 8 अप्रैल, 2007 को 10 10 बजे बनाया गया था। मैंने इस समस्या का समाधान नहीं किया, मेरे पास कहां पर कोई सुराग नहीं है। यह इसका कारण हो सकता है। लॉग-लोटेट के साथ लॉगफ़ाइल अभिलेखागार बनाते हैं। कॉमरेडपी द्वारा पोस्ट किया गया था गुरु 12 अप्रैल 2007 को 16 58. मैंने देखा कि मेरे कॉन्फ़िगरेशन में निश्चित रूप से ग़लत है, और यह संभवतः हम जिस समस्या को देख रहे हैं, इसके लिए जिम्मेदार है एवरस्टेट्स प्रीराटेट सेक्शन को जोड़ने में, मैं इसे समाप्त करना भूल गया था कि पैटर्न को प्रीराटेट इण्टीप्टीप्ट पोस्ट्रोटेट एंडक्रिप्ट होता है। इस प्रकार, मेल्स क्रोन के सावधान अवलोकन पर मुझे भेज रहा था, मैंने देखा कि यह पोस्टरॉट कमांड के बारे में शिकायत नहीं कर रहा था - क्योंकि वहां नहीं एन था प्रीराट के बाद ओप्लीपीट, यह प्रत्येक पंक्ति को प्रीराटेट कमांड के रूप में जारी करता है, जब तक कि पोस्टरोटेट एस एंड्रिप्ट तक नहीं होता है, जो कि ऐसा होता है, वह थोडा था जो अपाचे को पुनरारंभ करता है। अब अगर यह पुनरारंभ लॉग रोटेशन से पहले होता है, तो यह आश्चर्यजनक नहीं है कि अपाचे पुरानी फाइल का उपयोग कर रखता है। मुझे नहीं पता कि वास्तव में यह मुद्दा हल करेगा, मैं साप्ताहिक रोटेशन करता हूं और हाथ से एक को ट्रिगर करने के लिए कुछ अनिच्छुक हूं, लेकिन मुझे आशा है। logrotate के साथ लॉगफ़ाइल अभिलेखागार बनाना। पुन: mcs1 द्वारा सोमवार 21 अप्रैल 2008 को पोस्ट किया गया 05 03 पर। दुर्भाग्य से मेरे पास एक बड़ी समस्या है Logrotate सिर्फ syslog फ़ाइलों को मेरे पास एक डेबियन स्थिर स्थिर नहीं है। अगर मैं लॉग-लॉट चलाता हूँ- dvf आदि logrotate d syslog-ng मुझे मिलता है.रेटिंग पैटर्न मजबूर n bspfrom कमांड लाइन 4 रोटेशन रिक्त लॉग फाइल घुमाए नहीं हैं, लॉग लॉग के कारण ओएल डी लॉग को हटाया जाता है, rotating. Rotating pattern var log syslog को मजबूर nbs pfrom कमांड लाइन 7 रोटेशन खाली लॉग फाइल घुमाए जाते हैं, पुराने लो जीएस लॉग var log log logs लॉग को घुमाने की जरूरत है लॉग लॉग इन लॉग लॉग लॉग इन करें, लॉग-रोटेट करें 7 नाम var लॉग सिस्लॉग 8 के नामकरण, ररटेंक्यूंट 7, लॉगरस्टार्ट 1, आई 7, var लॉग सर्जॉग 7 रोटेटकैक 7, लॉस्टस्टार्ट 1, आई 6, नाम बदलकर var लॉग सर्सॉग 6 var log syslog 5 rotatecount 7, लॉगरस्टार्ट 1, आई 4, var लॉग सिस्लॉग 4 रोटेटकैक 7, लॉस्टार्ट 1, आई 3, var लॉग सिस्लॉग 3 रोटेटकैक 7, लॉस्टस्टार्ट 1 के लिए नामकरण करने के लिए नामित, घुमाएगी 7, लॉजस्टार्ट 1, आई 5 , i 2, var लॉग सिस्लॉग 2 रोटेटकैक 7, लॉगरस्टार्ट 1, आई 1 के नाम का नामकरण, var लॉग सिस्लॉग 1 रोटेट करना, लॉरस्टार्ट 1, आई 0, री लॉगिंग var लॉग सिस्लॉग टू var लॉग सिस्लॉग 1, पोस्टस्ट्रैट स्क्रिप्ट चलती स्क्रिप्ट एआरजी के साथ var log syslog etc init d syslog-ng फिर लोड देव नल त्रुटि संपीड़न के लिए var लॉग syslog 1 को खोलने में असमर्थ है.मैंने डीबग आउटपुट के अन्य हिस्सों को निकाल दिया है, यह सिर्फ एक ही स्क्रिप्ट इत्यादि logrotate d syslog-ng है। var लॉग संदेश 4 साप्ताहिक अनुपलब्ध नोटिफाइड सेक को घुमाने के लिए 4 साप्ताहिक अनुपलब्ध नोटिफाइट सेकेंड सेक 4 अनुपयोगी नोटिफ़ाप्टी साप्ताहिक संपीड़ित करें। var log syslog 7 दैनिक सेकेंड पोस्टरॉटेट आदि को घुमाएगा IIT d syslog-ng फिर से लोड नल एंडक्रिप्ट। फिर भी मैंने बहुत सारे कॉन्फ़िगर को छीन लिया है। यह सिर्फ मूल फ़ाइल का नाम नहीं बदलता है किसी भी मदद की काफी सराहना की जाती है मैं कुछ समय से यह लड़ रहा हूं.तुम्हें बहुत धन्यवाद। Logfotate के साथ लॉगफ़ाइल अभिलेखागार बनाते हैं। सोमवार 21 अप्रैल 2008 को 06 26 पर पोस्ट किया गया। माफ करना, मुझे खुद को एक बड़ा, बड़ा मूर्खतापूर्ण टोपी मिलना पड़ेगा। समस्या यह है कि वहाँ मौजूद है। Logrotate - dvf आदि logrotate d syslog - एनजी- डी डीबग का मतलब है कि कोई परिवर्तन नहीं किए गए हैं मैं अभी भी यह देखने के लिए इंतजार कर रहा हूं कि यह क्रोन के साथ घूमता है। मूल समस्या sysklogd के साथ थी, वह क्रोन से लॉग-इन नहीं करना चाहता था, जो syslog-ng में बदला गया था, जिसमें लॉगोटेट सेटअप होता है जो घुमाता है स्क्रिप्ट में शामिल किए गए var लॉग सिस्टमगॉग आदि इत्यादि एक अन्य मशीन पर यह पूरी तरह से सिस्कोलाड के साथ काम करता है, यहां तक ​​कि किसी भी अतिरिक्त स्क्रिप्ट के साथ काम करता है, इसलिए अभी भी इस के नीचे नहीं, लेकिन कम से कम यह अब घूमता है महान संसाधन Mcs1 के लिए बहुत बहुत धन्यवाद। logfot के साथ लॉगफ़ाइल अभिलेखागार। द्वारा पोस्ट किया गया colinc पर सोम 25 अगस्त 2008 03 03.मैं हमारे अपाचे लॉग फाइलों को घुमाने के लिए चाहूंगा निम्नलिखित शहर के accesslog 1 से शुरू करना क्योंकि यह हमारे मुख्य-डिस्क-स्पेस को भरने वाला मुख्य अपराधी है, मैं एक बार लॉग फ़ाइल को घुमाएगा दिन और संक्षिप्त करें फ़ाइल को संक्षिप्त करें जैसा कि अस्थायी रूप से अपाचे को पुन: प्रारंभ करने के लिए आकर्षक विकल्प का उपयोग करना था, जैसा कि वेब क्लाइंट एक्सेस को बाधित नहीं किया जा सकता है कृपया सलाह दें कि यह सुंदर विकल्प का उपयोग करके किया जा सकता है ताकि किसी को कोई स्पष्ट बहिष्कार न हो। फिर से logrotate के साथ लॉगफ़ाइल अभिलेखागार बनाना कॉन्सट द्वारा 25 अगस्त 2008 को 03 28 को पोस्ट किया गया। यहाँ वर्तमान में ईसी लॉग्रोटेट डी में मेरी फाइल है। missingok notifempty sharescripts postrotate bin kill - HUP cat 2 dev नल 2 dev नल सच्चा सिग्नल। जो वर्तमान में कुछ भी नहीं कर रहे हैं, लेकिन मैं साप्ताहिक रोटेशन के लिए कोई सीट नहीं देख सकता, लेकिन मैं pid पर एक मार कमांड देख सकता हूँ मुझे चिंता हो रही है कि मैं एपाचे साबित करने के लिए एक शानदार पुनरारंभ नहीं कर रहा हूं। लॉग्रोटेट के साथ लॉगफ़ाइल अभिलेखागार बना रहा है। कलंक पर 26 अगस्त 2008 को 00.00 पर कॉलिन ने लिखा था, मैं अपने खुद के प्रश्न का उत्तर दे रहा हूं, मुझे लगता है कि मैं सिर्फ बिन मार - HUP कैट 2 देव नल 2 देव अशक्त सच है यूएसआर sbin apachectl के साथ सच्चे और यह काम किया मैं ऊपर अपने सुझावों का उपयोग कर परीक्षण करेंगे। Logrotate. Posted के साथ logfile अभिलेखागार बनाने का निर्माण। 23 नवंबर 2008 को 16 08 पर बेनामी द्वारा पोस्ट किया। बहुत उपयोगी, धन्यवाद। हालांकि, मुझे लगता है कि शेडस्क्रिप्ट्स विकल्प का विवरण पीछे की ओर है साझा किए गए स्क्रिप्ट प्रत्येक लॉगफाइल के लिए व्यक्तिगत रूप से किसी भी एपोटेट या पोस्टस्ट्रॉट स्क्रिप्ट को चलाने के लिए अलग-अलग नोटशोर्ड स्क्रिप्ट्स। प्रत्येक लॉगफाइल के लिए स्क्रिप्ट चलाए जाने वाले व्यक्तिगत रूप से साझा किए गए स्क्रिप्ट एक बार स्क्रिप्ट चलाते हैं, चाहे कितने लॉगफ़ाइल घुमाए गए हों। फिर से logfot के साथ लॉगफ़ाइल अभिलेखागार बनाना। बेनामी द्वारा पोस्ट किया गया गुरु 1 मार्च 2012 को 10 में 33.मैं एक से अधिक बार लॉग-लोट नहीं कर पा रहा हूं। मेरे पास फाइल की मेरी सामग्री दैनिक अनुपलब्ध है 10 आकार 5 कश्मीर बनाएँ 0777 चक्की चकमा। MySQL धीमा लॉग सुरक्षित रूप से पुनर्रचना। यह ब्लॉग पोस्ट दो का हिस्सा है ग्रुपऑन के इंजीनियरिंग ब्लॉग से एक क्रॉस-पोस्ट है, ग्रुपटन में काइल ओपेनहेम के लिए धन्यवाद और एक और रिमाइंडर कि मैं अगले सप्ताह सांता क्लारा, कैलिफ़ोर्निया में पेर्कोना लाइव माइएसकॉएल सम्मेलन और एक्सपो में रहूंगा। मुझे वहां आप सत्रों का चेकआउट कर सकते हैं जो मैं यहां अग्रणी रहूंगा। मेरे आखिरी पोस्ट में, मैंने एक MySQL स्टैंडबाई सर्वर के कैश को रखने के लिए एक हल वर्णन किया है जिसका प्रयोग लॉन्च्योरिज़ के साथ MySQL धीमी लॉग समय 0 पर सेट है धीमा लॉग करने के लिए उच्च मात्रा की क्वेरी लॉग करते समय हम कुछ पाठ सीखते हैं। copytruncate का उपयोग न करें। Logrotate लॉग रोटेशन के लिए दो तकनीकों प्रदान करता है, आपके लॉग रोटेशन स्कीम की संभावना एक अलग नाम के साथ समान विकल्प प्रदान करती है। copytruncate प्रतियां फ़ाइल को एक नए नाम के साथ, और फिर मूल फ़ाइल को छोटा कर दिया जाता है। no copytruncate फाइल को एक नए नाम पर ले जाने के लिए नाम बदलें सिस्टम कॉल का उपयोग करता है, और फिर डेमन को इसकी लॉग फ़ाइल को फिर से खोलने के लिए सिग्नल की अपेक्षा करता है। माय एसक्यूएल धीमा लॉग लिखता Truncation MySQL को अवरुद्ध कर सकता है क्योंकि ओएस धारावाहक ऑपरेशन के दौरान इनोड तक पहुंच को धारावाहिक करता है। यह समस्या विशेष रूप से स्पष्ट है जब x3 के बजाय एक्सएफ 3 फाइल सिस्टम का उपयोग करते हुए। SIGHUP भेजने के बजाय प्रतिलिपि LOGS का उपयोग करें। जब copytruncate अक्षम है, तो MySQL को बताया जाना चाहिए धीमा लॉग फाइल को फिर से खोलने के लिए सिग्नलिंग के लिए दो विकल्प हैं। MYSQL प्रक्रिया के लिए एक HUP सिग्नल भेजें.फ्लस LOGS के लिए MySQL कंसोल या mysqladmin उपयोगिता का उपयोग करें.यह विकल्प समकक्ष होना चाहिए, लेकिन MySQL बग 65481 बताता है कि लॉग के अतिरिक्त HUP सिग्नल भी flushes टेबल फ़्लशिंग टेबल चलने वाले प्रश्नों को प्रभावित कर सकते हैं। रोटेशन के दौरान MySQL धीमी लॉग को अक्षम करें। फ़्लशिंग लॉग्स का समय लगता है इस बीच, क्वेरीज़ अभी भी निष्पादित किए जा रहे हैं, MySQL को धीमा लॉग बफर भरने से रोकने के लिए, हम लॉग रोटेशन के दौरान अस्थायी तौर पर MySQL धीमा लॉग को अक्षम करें.यह सब एक साथ रखकर। यहां एक धीमी लॉग के लिए एक लॉगोटेट कॉन्फ़िगरेशन फाइल है जो इन सर्वोत्तम तरीकों को दिखाती है। पीटर ने मई 2012 में यूरोपीय परामर्श टीम में शामिल हुए Percona में शामिल होने से पहले, कई अन्य बातों के अलावा, वह सन माइक्रोसिस्टम्स में काम किया, जो प्रदर्शन ट्यूनिंग में विशेष था और हंगरी की सबसे बड़ी सोशल नेटवर्किंग साइट पर एक डीबीए था। उन्होंने कई ओरेकल यूनिवर्सिटी के MySQL पाठ्यक्रमों को भी पढ़ाया था। वह 2000 के दशक के शुरुआती दिनों में ओपन सोर्स सॉफ़्टवेयर के साथ काम कर रहे थे और काम कर रहे थे पीटर की पहली और सबसे महत्वपूर्ण व्यावसायिक रुचि प्रदर्शन ट्यूनिंग वह वर्तमान में बुडापेस्ट, हंगरी में अपनी पत्नी और बेटे के साथ रहता है .00 टिप्पणियां। एक महत्वपूर्ण बात यह है कि अगर यो यू लगातार कनेक्शनों का उपयोग कर रहे हैं। वैश्विक चर लंबे समय से जांच की जाती है जब कनेक्शन बनाया जाता है, इसलिए यदि आप एक कनेक्शन पूल या लगातार कनेक्शन का उपयोग कर रहे हैं यह उपयोगी नहीं होगा क्योंकि यह पहले से ही खोले गए कनेक्शनों से प्रभावित नहीं होगा। इस समस्या को हल करने के लिए एक पेर्कोना सर्वर सुविधा। आप 5 5 में धीमी गति से ग्रोथ को नियंत्रित कर सकते हैं या 1 में 1 1 में 5 का उपयोग करेंग्लोबलॉगस्लोकट्रॉन्स्ट सेट कर सकते हैं और सर्वर वैश्विक वैल्यूएबल लाँगक्वोरि टाइम का उपयोग स्थानीय लोक के बजाय करेगा। PS 5 1 PS 5 5. MySQL 5 5 I लगता है कि FLUSH 50503 धीमी गति का उपयोग करने के लिए एक सामान्य फ्लूश LOGS की बजाय, जो अन्य बहुत अधिक महंगी लॉग फाइलों को भी छू देगा, इसके बजाय बेहतर होगा। पीटर बोरोस कहते हैं। मार्टिन, एंड्रयू, आप इन पर सही हैं आप SET का उपयोग भी कर सकते हैं वैश्विक धीमा लॉग ऑन और बंद करने के लिए बंद, जैसे बिल अपने उपकरण में यहाँ है। आपके अच्छे विचार के लिए धन्यवाद मेरे उपयोग के साथ एक सुरक्षा गलतफहमी है mysql - e, जो उपयोगकर्ता और पासवर्ड की आवश्यकता है क्योंकि प्रक्रिया बॉक्स सेट होना चाहिए। प्रीवेन करने के लिए धीमी लॉग बफर को भरने से MySQL टी, हम लॉग रोटेशन के दौरान अस्थायी रूप से MySQL धीमा लॉग को अक्षम करते हैं। ऐसा नहीं होना चाहिए जो प्रीराटैप अनुभाग में हो, जो कि आपको दिए गए पठार में दिखाई नहीं देता। एस्ट्रोस्टल, धीमे लॉग्स पोस्टरोट स्तान्ज़ा में अक्षम हैं ऑपरेशन का ऑर्डर है .1 लॉग्रोटेट लॉग फ़ाइल का नाम बदलता है MySQL नामित फाइल में लिखना जारी रखता है क्योंकि यह अभी तक दोबारा नहीं खोला गया है, 2 लॉगोटोटेट पोस्टरोटेट स्टांज़ा 2 ए चलाता है धीमा लॉगिंग रोका गया है ग्लोबल ल्वॉक्चररी टाइम 2 2 2 2 सेट करें बफर किए गए लॉग्स के लिए एक छोटी सी प्रतीक्षा करें, नींद 2 2 सी चुनें, फाइल हैंडल को फिर से खोल दिया जाता है, फ्लश लॉज 2 डी धीमे लॉगिंग फिर से शुरू होता है, वैश्विक लॉन्क्चररी टाइम lqtsave. रोगर सेट करता है कि यह लॉग रोटेशन के दौरान था जो मुझे फेंक दिया था क्योंकि केवल और पोस्ट विधियों, मैं पूर्व में शुरू करने के लिए विचार करता हूं और पोस्ट में बंद कर देता हूं। मुझे एक सर्वर पर एक समस्या का सामना करना पड़ा जिसमें रूट पासवर्ड है Logrotate जाहिरा तौर पर घर फ़ोल्डर में नहीं पढ़ता है इसलिए यह MySQL सर्वर में लॉग इन नहीं कर सकता है और पोस्टरोटेट कथन निष्पादित करें परिणाम यह है कि फ़ाइल कभी रिलीज़ नहीं हुई है.मैं उस पर काम कर रहा था जो कि एक उपयोगकर्ता को सुपर और रीलाअड विशेषाधिकार बनाकर बनाया क्योंकि पासवर्ड को कमांड पर पास करना होगा लाइन, यह सलाह दी जाती है कि logrotate config को रूट के लिए विशेष रूप से पठनीय हो। फेबियन, यह 600 अनुमतियों में क्रेडेंशियल्स को संचयित करके भी संबोधित किया जा सकता है, और फिर फाइल का संदर्भ mysql कमांड यूआरआर स्थानीय बिन मायस्केल-ई। आरएचएल सेंटोस ओरेकल लिनक्स में लॉग रोटेशन में संदर्भित करता है। Red Hat 5 x के लिए लॉगरोटेट के लिए डिफॉल्ट कॉन्फ़िगरेशन फ़ाइल है निम्न के रूप में। जैसा कि आप डिफ़ॉल्ट लॉग द्वारा देख सकते हैं साप्ताहिक घुमाया जाता है और कोई संपीड़न नहीं के साथ चार सप्ताह रखता है यदि अतिरिक्त RPMs से अतिरिक्त संकुल अधिष्ठापित किए जाते हैं, तो यह लॉग रोटेशन के लिए आदि logrotate में शामिल कर सकता है लेकिन कुछ पैकेज ऐसा करने के लिए sysadmin तक स्थानांतरण को ठीक से लागू करना जैसा कि आप देख सकते हैं कि डिफ़ॉल्ट सेटिंग बहुत असंतोषजनक भी हैं.पहले यह संकुल समझने लगते हैं कि लॉग-इन स्थापित करने में लॉग-टोकेट स्थापित होता है, जो कि लॉग-इन्सटेट में शामिल होता है और जो नहीं है RHEL की एक विशिष्ट स्थापना के बाद डायरेक्टरी लॉगोटेट डी पहले से स्थापित पैकेज उदाहरण के लिए। उनमें से सबसे महत्वपूर्ण है syslog यह बहुत छोटी है, कम से कम 10 लाइनें हैं। यदि आप उदाहरण के लिए rsyslog सेटअप को संशोधित करते हैं, तो आलोचकों के लिए एक अलग लॉग फ़ाइल बनाकर केवल संदेशों को आपको इस स्क्रिप्ट में जोड़ने की जरूरत है। विकल्प साझा किए गए स्क्रिप्ट को प्रत्येक लॉग के लिए डेमन के बार-बार आवेश को ब्लॉक किया गया है यहां बताया गया है कि यह वस्तु अर्थ मनुष्य के पृष्ठ में कैसे परिभाषित है। सामान्यतः, प्रत्येक लॉग के लिए सामान्यतः, prerotate और postrotate स्क्रिप्ट चलाए जाते हैं घुमाए गए और लॉग फ़ाइल का पूर्ण पथ स्क्रिप्ट के पहले तर्क के रूप में पारित किया गया है जिसका अर्थ है कि एक एकल स्क्रिप्ट को लॉग फ़ाइल प्रविष्टियों के लिए कई बार चलाया जा सकता है जो कई फाइलों से मेल खाती हैं जैसे कि var लॉग न्यूज़ उदाहरण यदि साझा किए गए स्क्रिप्ट्स निर्दिष्ट हैं, स्क्रिप्ट केवल एक बार चलाते हैं, चाहे कितने लॉग वाइल्डकार्ड पैटर्न से मेल खाते हों, और पूरे पैटर्न उनको दिया जाता है हालांकि, अगर पैटर्न में कोई भी घूर्णन करने की आवश्यकता नहीं होती है, तो स्क्रिप्ट सभी पर नहीं चलेंगे यदि स्क्रिप्ट त्रुटि से बाहर निकलती है शेष कार्यों को किसी भी लॉग के लिए निष्पादित नहीं किया जाएगा यह विकल्प nosharedscripts विकल्प ओवरराइड करता है और इसका मतलब है कि विकल्प बनाते हैं। एपाच लॉग रोटेशन निम्नलिखित सेटिंग्स का उपयोग कर किया जाता है। logrotate का मतलब है। इसका मतलब है कि लॉग रोटेशन प्रत्येक दिन की आधी रात के लिए निर्धारित है आमतौर पर यह ठीक है, लेकिन केंद्रीय syslog सर्वर के लिए आपको और अधिक आवेश की आवश्यकता हो सकती है। डिफ़ॉल्ट कॉन्फ़िगरेशन में महत्वपूर्ण लॉग फ़ाइलों की एक पूर्व निर्धारित संख्या जैसे var लॉग संदेश बहुत सीमित समय के लिए डिस्क पर रखा जाता है, और पुराने लॉग स्वचालित रूप से हटा दिए जाते हैं डिफ़ॉल्ट रूप से, लॉग केवल 4 सप्ताह के लिए रखा जाता है, जो उत्पादन सर्वर के लिए अस्वीकार्य है और सर्वर के प्रारंभिक कॉन्फ़िगरेशन के दौरान बदलना आवश्यक है। डिफ़ॉल्ट रूप से, लॉग केवल 4 सप्ताह के लिए रखा जाता है, जो उत्पादन सर्वरों के लिए अस्वीकार्य है और सर्वर के प्रारंभिक कॉन्फ़िगरेशन के दौरान बदलना आवश्यक है। अपने लॉग को बनाए रखने के लिए समय बदलने के लिए, घुमाए गए पैरामीटर को बदलना और बदलना आप विशिष्ट लॉग के लिए इसे ओवरराइड भी कर सकते हैं आदि लॉग लॉगोटेट डी निर्देशिका में फ़ाइलों को संपादित करके अधिक विवरण के लिए लॉगरोटेट मैन पेज देखें। पुराने लॉगफाइल को आमतौर पर जीज़िप के साथ संकुचित किया जाता है या बाद में पाठ की बेहतर संपीड़न प्रदान करता है अंतरिक्ष को बचाने के लिए फाइलें उन्हें भी एक नई डायरेक्टरी में ले जाया जा सकता है विकल्प को संक्षिप्त करें, नीचे विलंब संरेखित करें। मान लें कि हमारे पास एक नई सेवा फ़ॉबर है जिसे डायरेक्टरी में लॉग लिखने के लिए कॉन्फ़िगर किया गया है var log foobar इस डीमन के लिए रोटेशन की आवश्यकता को समायोजित करने के लिए हमें ज़रूरत है रोटेशन मापदंडों का वर्णन करने में लॉगोटेट कथन जोड़ने के लिए उदाहरण के लिए। मासिक अनुपयोगी घुमाएगी 6 सेकेंड देरीकम्प्रेस 640 रूट रूट मेल रूट लोकलहोस्ट शेडस्क्रिप्ट्स पोस्टरोटेट आदि बनाइएट डी फोबोर्स रिस्टार्ट एंडक्रिप्ट। निश्चित तौर पर यह सरल किया जा सकता है, लेकिन हम इस अधिक जटिल उदाहरण की चर्चा करते हैं। यहां हम यह सुनिश्चित करने के लिए मासिक का उपयोग करते हैं कि लॉग घुमाए गए हैं प्रत्येक महीने और 6 को घुमाने के लिए यह सुनिश्चित करने के लिए कि सात से अधिक पिछले लॉग्स नहीं रखे गए हैं अब लॉग की समय सीमा समाप्त होने पर एक विदेशी कार्यक्षमता हटा दी जाती है, यह डाक द्वारा निर्दिष्ट किए जाने से पहले लोकलहोस्ट को ईमेल करता है जो दैनिक लॉग के लिए किया जा सकता है अन्यथा ईमेल भी हो सकता है देरींपप्रेस के साथ सेकेंड का इस्तेमाल करना एक अनुशंसित सेटिंग है। लॉगरोटेट अगर शिकायत नहीं करता है कि लॉग फाइल्स गायब होने के कारण गायब हो चुकी है, तो लॉग को घुमाए जाने के बाद, एक नया बनाया जा रहा है जिसके द्वारा स्वामित्व के रूप में बनाया गया है उपयोगकर्ता और समूह रूट और सेवा को पुनरारंभ किया जाता है। यह घुमाए गए लॉग फ़ाइल को gzip के साथ सेक करने के लिए उपयोग किया जाता है। लॉग-इन के साथ लॉगफ़ाइल अभिलेखागार बना रहा है। लिनक्स मशीनों पर स्थापित कई सेवाओं में लॉगफ़ाइल उत्पन्न होंगे, जो बढ़ने और बढ़ने और बढ़ते हैं अगर अनचेक छोड़ दिया जाता है तो आप सावधानीपूर्वक नहीं रखते हैं, तो आसानी से लॉगफ़ाइलों के एक बड़े संग्रह के साथ डिस्क को भर सकते हैं। लॉगफाइल विकास को रखने का सबसे सामान्य तरीका है लॉगोटेट का उपयोग करना और कई डेबियन पैकेज डिफ़ॉल्ट रूप से इसके साथ काम करने के लिए सेटअप होते हैं। सबसे स्पष्ट पैकेज जो इसका उपयोग करता है वह अपाचे, वेबसर्वर है, जो डिफ़ॉल्ट रूप से डायरेक्ट्री में अपना लॉगफाइल रखता है var var लॉग अपाचे या var लॉग अपाचे 2 का उपयोग करें। यदि आप इस निर्देशिका की जांच करते हैं तो आप देखेंगे कि वहाँ लॉगफ़ाइलों का संग्रह है जो संग्रहीत हैं। यहां मौजूदा लॉगफ़ाइलों को कच्चे रखा जाता है जैसे कल की लॉगफ़ाइलें और पिछली लॉगफ़ाइलें gzip के साथ संकुचित होती हैं और केवल पांच हफ़्ते मुझे पता है कि यह पांच सप्ताह है और पांच दिन नहीं है क्योंकि मैंने विन्यास को देखा है - यह इस आउटपुट से स्पष्ट नहीं है। प्रक्रिया जो इन लॉगफ़ाइलों को संपीड़ित और घूर्णन करने के प्रभारी है I ogrotate और इसे डेबियन प्रतिष्ठानों पर प्रति दिन एक बार निष्पादित किया जाता है। जैसा कि हमने देखा था जब हम क्रॉन के साथ समयबद्धन के आदेशों को देख रहे थे, तो एक निर्देशिका है जिसमें स्क्रिप्ट होती है, जो प्रति दिन एक बार क्रियान्वित होती है यहां आपको लॉगरोटेट चालक स्क्रिप्ट मिल जाएगी.हर दिन स्क्रिप्ट चलती है और दो चीजों की जांच करती है। कॉन्फ़िगरेशन फ़ाइल। कॉन्फ़िगरेशन निर्देशिका आदि लॉग्रोटेट डी। बाद में वह है जहां हमारे अधिकांश संकुल कॉन्फ़िगर किए गए हैं इस निर्देशिका में कॉन्फ़िगरेशन फाइलें हैं जो अन्य संकुल स्थापित हैं उदाहरण के लिए अगर आप एपाचे फ़ाइल आदि में लॉगऑटेट डी एपाच इंस्टॉल किया जाएगा। कई सर्वर जैसे कि एक्सेल मेलसर्वर अपनी स्वयं की कॉन्फ़िगरेशन फ़ाइल स्थापित करेगा, और आप अपना स्वयं का जोड़ सकते हैं। एक सामान्य लॉग्रोटेट कॉन्फ़िगरेशन फ़ाइल इस तरह दिखती है। आप यहां कई महत्वपूर्ण चीजें देख सकते हैं सबसे स्पष्ट फाइलों की सूची है इस कॉन्फ़िगरेशन फ़ाइल से मिलान किया जाएगा। इसके बाद हमारे पास कॉन्फ़िगरेशन नियम का एक संग्रह है, प्रत्येक पंक्ति पर एक अलग एक हम ऊपर दिए गए उदाहरण में फाइलें हर हफ्ते घुमाए जाने चाहिए। रोज़ का विरोध करें.हमें एनजी से ज़्यादा फाइलें नहीं रखनी चाहिए, जिनके साथ पुरानी फाइलें जेजिप के साथ दिक्कतें हैं, निक्स्प्रप्रेस के पास। दफ़्तर सेकेंड की फाइलें संक्रमित करें। कॉम्पैक्ट संरेखित करें। लॉगफ़ाइल खाली है, तो कोई भी रोटेशन नहीं करें। विपरीत ifempty. create xx उपयोगकर्ता समूह। यदि हमें नई फाइल बनाना है तो उसे दिया गया मोड, मालिक और समूह दें। प्रत्येक लॉगफाइल के लिए कोई भी प्रीराटेट या पोस्ट्रोटेट स्क्रिप्ट को अलग-अलग चलाएं, अलग-अलग नोटशोर्ड स्क्रिप्ट्स पोस्ट करेंटस्ट्रेट एंडक्रिप्ट। इन दोनों के बीच रोटेशन प्रक्रिया के बाद कुछ भी निष्पादित होता है विपरीत पक्षपात. निश्चित रूप से इसे समझना चाहिए था। इस स्क्रिप्ट का नतीजा यह है कि किसी भी फाइल को हर सप्ताह सेकेंड घुमाया जाता है, अगर यह गैर-रिक्त है, तो नई फाइल 640 की फ़ाइल मोड के साथ बनाई गई है, और रोटेशन समाप्त हो जाने के बाद सर्वर को पुनरारंभ किया जाता है। यदि हम एक स्थानीय सेवा स्थापित करना चाहते हैं जो एक लॉगफ़ाइल बनाता है तो हम इसे एक बहुत ही आसानी से घुमाया जा सकता है, सिर्फ एक नया लॉग्रोटेट कॉन्फ़िगरेशन फ़ाइल जोड़कर. समझो हम में एक नई सेवा है लाल जो इसकी आउटपुट का उत्पादन करता है, हम इसे हर तरह से इस तरह की स्क्रिप्ट के साथ घुमाया जा सकता है। किसी एक समय में 7 दिनों से ज्यादा लॉगफ़ाइल नहीं रखें। अगर कोई लॉगफ़ाइल पुरानी फाइलों को ग़लती हुई है, लेकिन कल नहीं उपयोगकर्ता और समूह फ़्रेड के स्वामित्व के रूप में नए लॉगफ़ाइलों को बनाओ। लॉगफ़ाइल घूमने के बाद सेवा को पुन: प्रारंभ करें। लॉग्रोटेट निर्देशिका में मौजूदा फ़ाइलों में से कोई भी अधिक उदाहरणों के लिए जांच की जा सकती है - और मैनपेज दस्तावेज़ों में सभी विकल्पों का उपयोग किया जा सकता है एक स्पष्ट तरीके से। 22 मार्च 2008. CentOS या Red Hat Enterprise Linux के एक डिफ़ॉल्ट अधिष्ठापन पर लॉग रोटेशन स्क्रिप्ट स्वचालित रूप से प्रत्येक दिन अपाचे लॉग फ़ाइल को घुमाएगी और फिर सेवा को पुनः लोड करती है यह पोस्ट इस कार्रवाई को रोकने के लिए कैसे दिखता है स्वचालित रूप से या लॉग फाइल को घुमाने के लिए व्यवहार को बदलने के लिए अगर लॉग फाइल के लिए आपका नामकरण सम्मेलन डिफ़ॉल्ट से भिन्न होता है। डिफ़ॉल्ट रूप से CentOS या Red Hat Enterprise Linux सर्वर पर क्रॉन डेमॉन डायरेक्टो में स्क्रिप्ट चलाता है दैनिक आधार पर इसमें लॉग लॉटेट स्क्रिप्ट चलाना शामिल है जो यूएसआर sbin लॉग्रोटेट को रनिंग करता है इसे विन्यास फाइल दे रहा है इस फाइल का डिफ़ॉल्ट संस्करण निम्नानुसार है। ये डिफ़ॉल्ट चर पर्याप्त रूप से सीधे हैं और आप कितनी बार लॉग फाइल घूमते हैं , कितने पिछले लॉग फाइलों में से कितने उन्हें हटाने से पहले रखने के लिए, उन्हें संकुचित करें या नहीं, यह निर्देशिका आदि में सभी फाइलों को संसाधित करने के लिए logrotate को भी बताता है। लॉग फ़ाइल जो। CentOS पर अपाचे के लॉग रोटेशन को नियंत्रित करता है और Red Hat Enterprise Linux नाम दिया गया है और इस फाइल की मूलभूत सामग्री निम्नानुसार है। यह फ़ाइल क्या कह रही है, सभी फाइलें जो पैटर्न से मेल खाती हैं को घुमाने के लिए है CentOS और RHEL पर अपाचे में डिफ़ॉल्ट एक्सेस और त्रुटि लॉग फाइलों को एक्सेस लॉक और एररॉग नाम दिया गया है so they match this pattern. If you have changed the default names of the log files and they don t match this pattern, then you can have logrotate rotate your log files by making sure the pattern i s in this file in place of the line For example, if your log files were named and then would match them. If you do not wish the logrotate script to rotate your Apache log files at all, then you can simply delete this file like so, logged in either as root or using sudo. The changes will take effect the next time the logrotate script is run. Manage Linux log files with Logrotate By Jim McIntyre. December 27, 2000 TechRepublic. Log files are the most valuable tools available for Linux system security The logrotate program is used to provide the administrator with an up-to-date record of events taking place on the system The logrotate utility may also be used to back up log files, so copies may be used to establish patterns for system use In this Daily Drill Down, I ll cover the following topics. The logrotate configuration. Setting defaults for logrotate. Using the include option to read other configuration files. Setting rotation parameters for specific files. Using the include option to overrid e defaults. The logrotate program The logrotate program is a log file manager It is used to regularly cycle or rotate log files by removing the oldest ones from your system and creating new log files It may be used to rotate based on the age of the file or the file s size, and usually runs automatically through the cron utility The logrotate program may also be used to compress log files and to configure e-mail to users when they are rotated. The logrotate configuration The logrotate program is configured by entering options in the file This is a text file, which may contain any of the configuration options listed in the table below The options entered in may be used to set configuration parameters for any log file on the system These options may also be used to allow logrotate to read configuration parameters from other log files, by using the include parameter. Softpanorama Recommended. logrotate is designed to ease administration of systems that generate large numbers of log files It al lows automatic rotation, compression, removal, and mailing of log files Each log file may be handled daily, weekly, monthly, or when it grows too large. Normally, logrotate is run as a daily cron job It will not modify a log multiple times in one day unless the criterium for that log is based on the log s size and logrotate is being run multiple times each day, or unless the - f or - force option is used. Any number of config files may be given on the command line Later config files may override the options given in earlier files, so the order in which the logrotate config files are listed is important Normally, a single config file which includes any other config files which are needed should be used See below for more information on how to use the include directive to accomplish this If a directory is given on the command line, every file in that directory is used as a config file. If no command line arguments are given, logrotate will print version and copyright information, along with a short usage summary If any errors occur while rotating logs, logrotate will exit with non-zero status. Turns on debug mode and implies - v In debug mode, no changes will be made to the logs or to the logrotate state file.-f --force Tells logrotate to force the rotation, even if it doesn t think this is necessary Sometimes this is useful after adding new entries to a logrotate config file, or if old log files have been removed by hand, as the new files will be created, and logging will continue correctly - m --mail command Tells logrotate which command to use when mailing logs This command should accept two arguments 1 the subject of the message, and 2 the recipient The command must then read a message on standard input and mail it to the recipient The default mail command is bin mail - s - s, --state statefile Tells logrotate to use an alternate state file This is useful if logrotate is being run as a different user for various sets of log files The default state file is --usage Prints a s hort usage message - v --verbose Turns on verbose mode. Configuration File. logrotate reads everything about the log files it should be handling from the series of configuration files specified on the command line Each configuration file can set global options local definitions override global ones, and later definitions override earlier ones and specify logfiles to rotate A simple configuration file looks like this. The first few lines set global options in the example, logs are compressed after they are rotated Note that comments may appear anywhere in the config file as long as the first non-whitespace character on the line is a. The next section of the config files defined how to handle the log file var log messages The log will go through five weekly rotations before being removed After the log file has been rotated but before the old version of the log has been compressed , the command sbin killall - HUP syslogd will be executed. The next section defines the parameters for both and They are rotated whenever it grows over 100k in size, and the old logs files are mailed uncompressed to after going through 5 rotations, rather than being removed The sharedscripts means that the postrotate script will only be run once after the old logs have been compressed , not once for each log which is rotated Note that the double quotes around the first filename at the beginning of this section allows logrotate to rotate logs with spaces in the name Normal shell quoting rules apply, with , , and characters supported. The last section defines the parameters for all of the files in var log news Each file is rotated on a monthly basis This is considered a single rotation directive and if errors occur for more than one file, the log files are not compressed. Please use wildcards with caution If you specify , logrotate will rotate all files, including previously rotated ones A way around this is to use the olddir directive or a more exact wildcard such as. Here is more information on the dir ectives which may be included in a logrotate configuration filepress Old versions of log files are compressed with gzip 1 by default See also nocompress compresscmd Specifies which command to use to compress log files The default is gzip See also compress uncompresscmd Specifies which command to use to uncompress log files The default is gunzip compressext Specifies which extension to use on compressed logfiles, if compression is enabled The default follows that of the configured compression command compressoptions Command line options may be passed to the compression program, if one is in use The default, for gzip 1 , is -9 maximum compression copy. Make a copy of the log file, but don t change the original at all This option can be used, for instance, to make a snapshot of the current log file, or when some other utility needs to truncate or parse the file When this option is used, the create option will have no effect, as the old log file stays in place. copytruncate Truncate the orig inal log file in place after creating a copy, instead of moving the old log file and optionally creating a new one It can be used when some program cannot be told to close its logfile and thus might continue writing appending to the previous log file forever Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost When this option is used, the create option will have no effect, as the old log file stays in place create mode owner group Immediately after rotation before the postrotate script is run the log file is created with the same name as the log file just rotated mode specifies the mode for the log file in octal the same as chmod 2 , owner specifies the user name who will own the log file, and group specifies the group the log file will belong to Any of the log file attributes may be omitted, in which case those attributes for the new file will use the same values as the original log file for the omitted attributes T his option can be disabled using the nocreate option daily. Log files are rotated every day. dateext Archive old versions of log files adding a daily extension like YYYYMMDD instead of simply adding a number The extension may be configured using the dateformat option dateformat formatstring Specify the extension for dateext using the notation similar to strftime 3 function Only Y m d and s specifiers are allowed The default value is - Y m d Note that also the character separating log name from the extension is part of the dateformat string The system clock must be set past Sep 9th 2001 for s to work correctly Note that the datestamps generated by this format must be lexically sortable i e first the year, then the month then the day e g 2001 12 01 is ok, but 01 12 2001 is not, since 01 11 2002 would sort lower while it is later This is because when using the rotate option, logrotate sorts all rotated filenames to find out which logfiles are older and should be removed delaycompress Postpo ne compression of the previous log file to the next rotation cycle This only has effect when used in combination with compress It can be used when some program cannot be told to close its logfile and thus might continue writing to the previous log file for some time extension ext Log files with ext extension can keep it after the rotation If compression is used, the compression extension normally appears after ext For example you have a logfile named and want to rotate it to instead of ifempty Rotate the log file even if it is empty, overriding the notifempty option ifempty is the default include fileordirectory Reads the file given as an argument as if it was included inline where the include directive appears If a directory is given, most of the files in that directory are read in alphabetic order before processing of the including file continues The only files which are ignored are files which are not regular files such as directories and named pipes and files whose names end with o ne of the taboo extensions, as specified by the tabooext directive The include directive may not appear inside a log file definition mail address When a log is rotated out-of-existence, it is mailed to address If no mail should be generated by a particular log, the nomail directive may be used mailfirst When using the mail command, mail the just-rotated file, instead of the about-to-expire file maillast When using the mail command, mail the about-to-expire file, instead of the just-rotated file this is the default maxage count Remove rotated logs older than count days The age is only checked if the logfile is to be rotated The files are mailed to the configured address if maillast and mail are configured minsize size Log files are rotated when they grow bigger than size bytes, but not before the additionally specified time interval daily weekly monthly or yearly The related size option is similar except that it is mutually exclusive with the time interval options, and it causes log fil es to be rotated without regard for the last rotation time When minsize is used, both the size and timestamp of a log file are considered missingok If the log file is missing, go on to the next one without issuing an error message See also nomissingok monthly Log files are rotated the first time logrotate is run in a month this is normally on the first day of the month nocompress Old versions of log files are not compressed See also compress nocopy. Do not copy the original log file and leave it in place this overrides the copy option. nocopytruncate Do not truncate the original log file in place after creating a copy this overrides the copytruncate option nocreate New log files are not created this overrides the create option nodelaycompress Do not postpone compression of the previous log file to the next rotation cycle this overrides the delaycompress option nodateext Do not archive old versions of log files with date extension this overrides the dateext option nomail. Don t mail old lo g files to any address. nomissingok If a log file does not exist, issue an error This is the default noolddir Logs are rotated in the same directory the log normally resides in this overrides the olddir option nosharedscripts Run prerotate and postrotate scripts for every log file which is rotated this is the default, and overrides the sharedscripts option The absolute path to the log file is passed as first argument to the script If the scripts exit with error, the remaining actions will not be executed for the affected log only noshred Do not use shred when deleting old log files See also shred notifempty Do not rotate the log if it is empty this overrides the ifempty option olddir directory Logs are moved into directory for rotation The directory must be on the same physical device as the log file being rotated, and is assumed to be relative to the directory holding the log file unless an absolute path name is specified When this option is used all old versions of the log end up in d irectory This option may be overridden by the noolddir option postrotate endscript The lines between postrotate and endscript both of which must appear on lines by themselves are executed using bin sh after the log file is rotated These directives may only appear inside a log file definition Normally, the absolute path to the log file is passed as first argument to the script If sharedscripts is specified, whole pattern is passed to the script See also prerotate See sharedscripts and nosharedscripts for error handling prerotate endscript The lines between prerotate and endscript both of which must appear on lines by themselves are executed using bin sh before the log file is rotated and only if the log will actually be rotated These directives may only appear inside a log file definition Normally, the absolute path to the log file is passed as first argument to the script If sharedscripts is specified, whole pattern is passed to the script See also postrotate See sharedscripts and nosh aredscripts for error handling firstaction endscript The lines between firstaction and endscript both of which must appear on lines by themselves are executed using bin sh once before all log files that match the wildcarded pattern are rotated, before prerotate script is run and only if at least one log will actually be rotated These directives may only appear inside a log file definition Whole pattern is passed to the script as first argument If the script exits with error, no further processing is done See also lastaction lastaction endscript The lines between lastaction and endscript both of which must appear on lines by themselves are executed using bin sh once after all log files that match the wildcarded pattern are rotated, after postrotate script is run and only if at least one log is rotated These directives may only appear inside a log file definition Whole pattern is passed to the script as first argument If the script exits with error, just an error message is shown as this is the last action See also firstaction rotate count Log files are rotated count times before being removed or mailed to the address specified in a mail directive If count is 0, old versions are removed rather than rotated size size Log files are rotated when they grow bigger than size bytes If size is followed by k the size is assumed to be in kilobytes If the M is used, the size is in megabytes, and if G is used, the size is in gigabytes So size 100 size 100k size 100M and size 100Gare all valid sharedscripts Normally, prerotate and postrotate scripts are run for each log which is rotated and the absolute path to the log file is passed as first argument to the script That means a single script may be run multiple times for log file entries which match multiple files such as the var log news example If sharedscripts is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern, and whole pattern is passed to them However, if none of the logs in the pattern require rotating, the scripts will not be run at all If the scripts exit with error, the remaining actions will not be executed for any logs This option overrides the nosharedscripts option and implies create option shred. Delete log files using shred - u instead of unlink This should ensure that logs are not readable after their scheduled deletion this is off by default See also noshred. shredcycles count Asks GNU shred 1 to overwite log files count times before deletion Without this option, shred s default will be used start count This is the number to use as the base for rotation For example, if you specify 0, the logs will be created with a 0 extension as they are rotated from the original log files If you specify 9, log files will be created with a 9, skipping 0-8 Files will still be rotated the number of times specified with the count directive tabooext list The current taboo extension list is changed see the include directive for information on the taboo extensions If a pr ecedes the list of extensions, the current taboo extension list is augmented, otherwise it is replaced At startup, the taboo extension list contains rpmsave v swp rpmnew. cfsaved and weekly. Log files are rotated if the current weekday is less than the weekday of the last rotation or if more than a week has passed since the last rotation This is normally the same as rotating logs on the first day of the week, but it works better if logrotate is not run every night. Log files are rotated if the current year is not the same as the last rotation. Default state file. FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner We are making such material available in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc We believe this constitutes a fair use of any such copyrighted material as provided for in section 107 of the US Copyright Law In accordance with Title 17 U S C Section 107, the material on this site is distributed without profit exclusivly for research and educational purposes If you wish to use copyrighted material from this site for purposes of your own that go beyond fair use , you must obtain permission from the copyright owner. ABUSE IPs or network segments from which we detect a stream of probes might be blocked for no less then 90 days Multiple types of probes increase this period.

No comments:

Post a Comment