Sponsored Content
Top Forums Shell Programming and Scripting Null a file when /var usage is at 90% Post 302914953 by RavinderSingh13 on Friday 29th of August 2014 09:19:28 AM
Old 08-29-2014
Hello newtoaixos,

We can give you basic idea, then kindly try by yourself and let us know if you face any issues, as our forum's aim is to help each person to learn.
Here are some points by which you can start your script.
  1. you can take threshould of filesystem when you want to nullify the large size log file in a variable.
  2. you can then use if else statements to check the disk space if this condition is TRUE means if threshould of Disk space crosses then you can nullify the file by the command which you have given. (Not sure if this will allow us to nullify logs as some processes needs to be stopped first then they will allow to nullify the log files.)
Please try it by your self and let us know if you have queries. Also you can always refer man if or man test for your help too.

EDIT: Also kindly use code tags for commands and codes which you are going to mention in your post, you can use the preview post option too before posting.


Thanks,
R. Singh

Last edited by RavinderSingh13; 08-29-2014 at 11:11 AM.. Reason: Requesting user to add code tags - RBATTE1 added LIST=i tags
 

10 More Discussions You Might Find Interesting

1. Solaris

Usage of /var/tmp/ directory on Solaris 10

Hi All, I have some threaded applications. Design of the application is such that one thread will decode some data and put it in data structure, And main thread will wait for another child threads pick up the decoded data. The data will be large decoded files. Once decoded data is picked by... (1 Reply)
Discussion started by: patilmuragesh
1 Replies

2. UNIX for Dummies Questions & Answers

var memory usage increasing

Hi all Just a couple days ago my /var/ partition was at 63% now its shot up to 83%. I checked my log file sizes and they same ok # ls -l |more total 38820 -rw-r----- 1 root root 3754 Aug 1 19:26 acpid drwxrwxrwx 2 root root 4096 Aug 24 04:11 admserv -rw------- ... (28 Replies)
Discussion started by: mcraul
28 Replies

3. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

4. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

5. Solaris

diff b/w /var/log/syslog and /var/adm/messages

hi sirs can u tell the difference between /var/log/syslogs and /var/adm/messages in my working place i am having two servers. in one servers messages file is empty and syslog file is going on increasing.. and in another servers message file is going on increasing but syslog file is... (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

6. Solaris

Lost /var/sadm/install/contents file and /var/sadm/pkg

Hello, I recently found that my /var/sadm/install/contents, ~/admin/default, /var/spool/patch and /var/spool/pkg files were empty. This broke the pkginfo, pkgchk and other package related tools. The pkgmap no longer points to where the applications have been installed. I have replaced the... (0 Replies)
Discussion started by: ronin42
0 Replies

7. Solaris

Difference between /var/log/syslog and /var/adm/messages

Hi, Is the contents in /var/log/syslog and /var/adm/messages are same?? Regards (3 Replies)
Discussion started by: vks47
3 Replies

8. Shell Programming and Scripting

Redirecting standard out to /dev/null goes to file "/dev/null" instead

I apologize if this question has been answered else where or is too elementary. I ran across a KSH script (long unimportant story) that does this: if ; then CAS_SRC_LOG="/var/log/cas_src.log 2>&1" else CAS_SRC_LOG="/dev/null 2>&1" fithen does this: /usr/bin/echo "heartbeat:... (5 Replies)
Discussion started by: jbmorrisonjr
5 Replies

9. Shell Programming and Scripting

Csh , how to set var value into new var, in short string concatenation

i try to find way to make string concatenation in csh ( sorry this is what i have ) so i found out i can't do : set string_buff = "" foreach line("`cat $source_dir/$f`") $string_buff = string_buff $line end how can i do string concatenation? (1 Reply)
Discussion started by: umen
1 Replies

10. Shell Programming and Scripting

Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog

I have been searching and reading about syslog. I would like to know how to Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog. tail -f /var/log/messages dblogger: msg_to_dbrow: no logtype using missing dblogger: msg_to_dbrow_str: val ==... (2 Replies)
Discussion started by: kenshinhimura
2 Replies
MAKEDUMPFILE.CONF(5)                                    Linux System Administrator's Manual                                   MAKEDUMPFILE.CONF(5)

NAME
makedumpfile.conf - The filter configuration file for makedumpfile(8). DESCRIPTION
The makedumpfile.conf is a configuration file for makedumpfile tool. makedumpfile.conf file contains the erase commands to filter out desired kernel data from the vmcore while creating DUMPFILE using makedumpfile tool. makedumpfile reads the filter config and builds the list of memory addresses and its sizes after processing filter commands. The memory locations that require to be filtered out are then poi- soned with character X (58 in Hex). FILE FORMAT
The file consists of module sections that contains filter commands. A section begins with the name of the section in square brackets and continues until the next section begins. "["<ModuleName>"]" <FilterCommands> where "[" is the character [ "]" is the character ] <ModuleName> is either 'vmlinux' or name of a Linux kernel module. <FilterCommands> is a list of one or more filter commands as described in the section FILTER COMMANDS of this manual page. The section name indicates a kernel module name (including vmlinux) where the symbols specified in subsequent erase commands belong to. The unnamed section defaults to [vmlinux] section. However, a user can also explicitly define [vmlinux] section. The sections help makedumpfile tool to select appropriate kernel or module debuginfo file before processing the subsequent erase commands. Before selecting appropriate debuginfo file, the module name is validated against the loaded modules from the vmcore. If no match is found, then the section is ignored and makedumpfile skips to the next module section. If match is found, then makedumpfile will try to load the corresponding module debug- info file. If module debuginfo is not available then, makedumpfile will skip the section with a warning message. FILTER COMMANDS
filter command A filter command is either an erase command or a loop construct. Each erase command and loop construct must start with a new line. Each filter command describes data in the dump to be erased. Syntax: <EraseCommands>|<LoopConstruct> where <EraseCommands> Described in the subsection erase command of this manual page. <LoopConstruct> Described in the subsection Loop construct of this manual page. erase command Erase specified size of a kernel data referred by specified kernel/module symbol or its member component. The erase command syntax is: erase <Symbol>[.member[...]] [size <SizeValue>[K|M]] erase <Symbol>[.member[...]] [size <SizeSymbol>] erase <Symbol>[.member[...]] [nullify] where <Symbol> A kernel or module symbol (variable) name that is part of global symbols /proc/kallsyms. <SizeValue> A positive integer value as a size of the data in bytes to be erased. The suffixes 'K' and 'M' can be used to specify kilobytes and Megabytes respectively where, K means 1024 bytes and M means 1024 ^ 2 = 1048576 bytes. The suffixes are not case sensitive. <SizeSymbol> A simple expression of the form <Symbol>[.member[...]] that denotes a symbol which contains a positive integer value as a size of the data in bytes to be erased. <Symbol>[.member[...]] A simple expression that results into either a global kernel symbol name or its member components. The expression always uses '.' operator to specify the member component of kernel symbol or its member irrespective of whether it is of pointer type or not. member[...] Member or component of member in <Symbol>. The erase command takes two arguments 1. kernel symbol name or its member components and 2. size of the data referred by argument (1) OR nullify keyword. The second argument size OR nullify is optional. The unit for size value is in bytes. If size option is not specified then the size of the first argument is determined according to its data type using dwarf info from debuginfo file. In case of 'char *' data type, the length of string pointed by 'char *' pointer is determined with an upper limit of 1024. The size can be specified in two forms 1. a integer value as explained above (<SizeValue>) and 2. a simple expression in the form of <Symbol>[.member[...]]] that results into base type (integer) variable. If the specified <Symbol> is of type 'void *', then user needs to provide either size or nullify option, otherwise the erase command will not have any effect. The nullify option only works if specified <Symbol> is a pointer. Instead of erasing data pointed by the specified pointer nullify erases the pointer value and set it to '0' (NULL). Please note that by nullifying the pointer values may affect the debug ability of created DUMP- FILE. Use the nullify option only when the size of data to be erased is not known. e.g. data pointed by 'void *'. Let us look at the makedumpfile.conf file from the example below which was configured to erase desired kernel data from the kernel module with name mymodule. At line 1 and 3, the user has not specified size option while erasing 'array_var' and 'mystruct1.name' symbols. Instead the user depends on makedumpfile to automatically determine the sizes to be erased i.e 100 bytes for 'array_var' and 11 bytes for 'mys- truct1.name'. At line 2, while erasing the 'mystruct1.buffer' member the user has specified the size value 25 against the actual size of 50. In this case the user specified size takes the precedence and makedumpfile erases only 25 bytes from 'mystruct1.buffer'. At line 4, the size of the data pointed by void * pointer 'mystruct1.addr' is unknown. Hence the nullify option has been specified to reset the pointer value to NULL. At line 5, the 'mystruct2.addr_size' is specified as size argument to determine the size of the data pointed by void * pointer 'mystruct2.addr'. Example: Assuming the following piece of code is from kernel module 'mymodule': struct s1 { char *name; void *addr1; void *addr2; char buffer[50]; }; struct s2 { void *addr; long addr_size; }; /* Global symbols */ char array_var[100]; struct s1 mystruct1; struct s2 *mystruct2; int foo() { ... s1.name = "Hello World"; ... } makedumpfile.conf: [mymodule] erase array_var erase mystruct1.buffer size 25 erase mystruct1.name erase mystruct1.addr1 nullify # Assuming addr2 points to 1024 bytes erase mystruct1.addr2 size 1K erase mystruct2.addr size mystruct2.addr_size EOF Loop construct A Loop construct allows the user to traverse the linked list or array elements and erase the data contents referred by each element. for <id> in {<ArrayVar> | <StructVar> via <NextMember> | <ListHeadVar> within <StructName>:<ListHeadMember>} erase <id>[.MemberExpression] [size <SizeExpression>|nullify] [erase <id>...] [...] endfor where <id> Arbitrary name used to temporarily point to elements of the list. This is also called iteration variable. <ArrayVar> A simple expression in the form of <Symbol>[.member[...]] that results into an array variable. <StructVar> A simple expression in the form of <Symbol>[.member[...]] that results into a variable that points to a structure. <NextMember> Member within <StructVar> that points to an object of same type that of <StructVar>. <ListHeadVar> A simple expression in the form of <Symbol>[.member[...]] that results into a variable of type struct list_head. <StructName> Name of the structure type that can be traversed using HEAD variable <ListHeadVar> and contains a member named <ListHeadMember>. <ListHeadMember> Name of a member in <StructName>, of type struct list_head. <MemberExpression> A simple expression in the form of [.member[...]] to specify a member or component of an element in <ArrayVar>, <StructVar> or <StructName>. <SizeExpression> Size value in the form of <SizeValue>, <id>[.MemberExpression] or <Symbol>[.member[...]]. The for loop construct allows to iterate on list of elements in an array or linked lists. Each element in the list is assigned to iteration variable <id>. The type of the iteration variable is determined by that of the list elements. The entry specified after 'in' terminal is called LIST entry. The LIST entry can be an array variable, structure variable/pointer or a struct list_head type variable. The set of erase commands specified between for and endfor, will be executed for each element in the LIST entry. If the LIST entry specified is an array variable, then the loop will be executed for each array element. The size of the array will be determined by using dwarf information. If the LIST entry specified is a structure variable/pointer, then a traversal member (<NextMember>) must be specified using 'via' terminal. The for loop will continue until the value of traversal member is NULL or matches with address of the first node <StructVar> if it is a circular linked list. If the LIST entry is specified using a struct list_head type variable, then within terminal must be used to specify the structure name <StructName> that is surrounding to it along with the struct list_head type member after ':' which is part of the linked list. In the erase statement <id> then denotes the structure that the list_head is contained in (ELEMENT_OF). The below example illustrates how to use loop construct for traversing Array, linked list via next member and list_head. Example: Assuming following piece of code is from kernel module 'mymodule': struct s1 { struct *next; struct list_head list; char private[100]; void *key; long key_size; }; /* Global symbols */ struct s1 mystruct1; static LIST_HEAD(s1_list_head); struct s1 myarray[100]; void foo() { struct s1 *s1_ptr; ... ... s1_ptr = malloc(...); ... ... list_add(&s1_ptr->list, &s1_list_head); ... } makedumpfile.conf: [mymodule] # erase private fields from list starting with mystruct1 connected via # 'next' member: for mys1 in mystruct1 via next erase mys1.private erase mys1.key size mys1.key_size endfor # erase private fields from list starting with list_head variable # s1_list_head. for mys1 in s1_list_head.next within s1:list erase mys1.private erase mys1.key size mys1.key_size endfor # erase private fields from all elements of the array myarray: for mys1 in myarray erase mys1.private erase mys1.key size mys1.key_size endfor EOF In the above example, the first for construct traverses the linked list through a specified structure variable mystruct1 of type struct s1. The linked list can be traversed using 'next' member of mystruct1. Hence a via terminal has been used to specify the traversal member name 'next'. The second for construct traverses the linked list through a specified struct list_head variable s1_list_head.next. The global symbol s1_list_head is a start address of the linked list and its next member points to the address of struct list_head type member 'list' from struct s1. Hence a within terminal is used to specify the structure name 's1' that can be traversed using s1_list_head.next variable along with the name of struct list_head type member 'list' which is part of the linked list that starts from s1_list_head global symbol. The third for construct traverses the array elements specified through a array variable myarray. SEE ALSO
makedumpfile(8) makedumpfile v1.4.3 29 February 2012 MAKEDUMPFILE.CONF(5)
All times are GMT -4. The time now is 09:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy