Blog

  • How to enable the debug log in NGINX?

    How to enable the debug log in NGINX?

    • The default configuration in nginx.conf file is;

    error_log /path/to/logfile-folder/error.log;

    • change the above line with the following;

    error_log /path/to/logfile-folder/error.log debug;

    • Restart NGINX.

  • Recover LV or VG after running lvreduce, lvremove, lvresize

    Recover LV or VG after running lvreduce, lvremove, lvresize

    Before applying a change to a logical volume (LV), it automatically creates a backup of the volume group (VG) and even an archive of the logical volume on which the operation is performed. This enables the restoration of the lost logical volume from the archive.

    • To restore the LV, first fund the LV in the archive. In the below command, [VG] is the name of the volume group from which you want to restore LV. This command will display all available backups for the VG.

    # vgcfgrestore -l [VG]

    • Grep the string ‘command_executed’ from the output of the above command by appending the grep command as follows.

    # vgcfgrestore -l [VG] | grep -A2 -B2 "<command_executed>"

    • Copy the filename of backup that is your logical volume. You can pinpoint your required LV by reading the description and timestamps.
    • Test the archive using the following command.

    # vgcfgrestore --test -f <archive_file_path_here> [VG]

    • Finally, restore LV/VG as follows.

    # vgcfgrestore -f <archive_file_path> <VG name>

    • Unmount the volume, reboot the server, and remount volume

  • What is Dynamic Pricing & How It Works

    What is Dynamic Pricing & How It Works

    Car drivers are all too aware of this. At the gas station, prices change several times a day, sometimes even while you are filling up gas in your car. This is one typical example of dynamic pricing, a tool that dates back to the dawn of commerce. Dynamic prices, which can be adjusted flexibly to any market situation, allow you to manage the revenue generated by your services and products.

    Dynamic price management is currently gaining attention in online retail, but it has long been standard practice in pricing flights, travel, and lodging. For example, factors such as capacity utilization, season, time, and competitor behavior influence the price. Even in traditional retail, digital shelf displays are increasingly replacing traditional price tags, allowing pricing to become more flexible and automated.

    How dynamic pricing works?

    There are numerous other examples of dynamic pricing in everyday life: Fruit that has been left on the supermarket shelf for an extended time is usually sold at a reduced price. We can thank flexible prices when fuel prices rise just in time for holidays, and hill station hotels become more affordable in cold weather. A dynamic price adjustment can also be seen when regular customers receive a discount. Many ski resorts offer discounts to entice visitors in bad weather, and ticket prices for game matches, for example, often vary depending on a particular day, weather, chances of winning, or appeal of a game in the United States.

    These examples mainly deal with well-known dynamic pricing models that almost everyone encounters daily. In all of these examples, the price fluctuates over time, depending on the competition or strategic considerations and factors that the retailer deems appropriate for increasing profit or improving customer retention – ideally both simultaneously.

    The strategies vary, but the goals are usually the same: in addition to maximizing profit, providers use dynamic prices to increase customer retention – for example, through discounts. After all, customers are likely to return if they believe they are getting a good deal.

    Big data and dynamic pricing

    More significant opportunities for dynamic pricing are emerging as a result of digitalization. Big data is the key, and thanks to data-driven marketing, fully automated real-time analyses are no problem.

    Dynamic price management in e-commerce is frequently based on algorithms that analyze customer data. Major online retailers do have access to the data of millions of customers, which analysis programs can use. When combined with current market events, this data can be used to adjust prices to supply and demand, either manually or automatically – on a broad scale, for specific target groups, or even for individual customers. A variety of different strategies can be used in this situation. The algorithms themselves are usually kept under wraps, which is understandable given their importance to business success.

    Examples of dynamic pricing

    According to the strategy, a look at the sales figures reveals which products are currently popular and purchased over others, leading to a price increase to maximize profit. The following is always a good question: What is the current level of the customer’s willingness to pay? This can be known by using the clues provided by big data.

    Let us take a different approach. To beat the competition, a popular product is reduced in price so that customers buy it from the lower-cost provider. Accessories are frequently offered to the buyer simultaneously as dynamically raised prices (sometimes sharply). If a customer is in the middle of a purchase and finds a good deal, they are likely to buy an accessory as well – even if the price is significantly higher. Their incentive to compare prices with competitors who already offered the product they wanted at a higher price is low.

    Ideally, this allows the merchant to sell more products using targeted, dynamic pricing models and increase profit by selling accessories at a higher price while the customer feels they have found a good deal. In most cases, this is the case, and it improves customer retention.

    Prices for personalized services?

    Prices can even differ from one customer to the next because every online customer’s habits, interests, demographic data, and behavioral patterns can all be used to draw valuable conclusions. A personalized price refers to the fact that different customers viewing the same product simultaneously receive their special price. The goal is to make the best possible use of their maximum willingness to pay at any given moment. This dynamic pricing is frequently based on data-driven marketing mechanisms.

    Consider the following scenario: Anyone who surfs on the go with a high-end smartphone may pay an increased price for products when shopping online simply because of dynamic pricing. A similar analysis tool could classify users of expensive devices as having the ability to pay higher prices in general. If these users have previously purchased expensive products, this trend may continue, resulting in higher personalized prices.

    Manufacturers and merchants have much leeway in terms of pricing models, and they can also undercut competitors. Free pricing is one of the fundamental pillars of the market economy. Only a few legal exceptions exist, such as set book prices. Prices that are dynamically adjusted, as well as individualized prices, are generally permitted.

    How to avoid dynamic pricing?

    Dynamic pricing models can be found in almost every industry. It is often impossible to avoid flexible prices – for example, seasonal factors like the run-up to Christmas cause prices to rise before falling. We also benefit from flexible pricing in many cases, such as discounts for loyal customers or the beach lounger mentioned earlier, which becomes cheaper in lousy weather. Therefore, dynamic prices can be beneficial to consumers, even if they appear to be beneficial only to businesses.

    We cannot avoid dynamic pricing when shopping with large online retailers like Walmart. However, there are certain ways that can help to avoid paying peak e-commerce prices. The issue is that the algorithms’ inner workings are largely unknown. As a result, the advice provided here is based on observations and indicators. As a result, the success of the algorithms may vary depending on how they are designed and adapted.

    Date and time of day

    When shopping online, keep the time of day in mind. When many people are shopping on weekends and evenings, prices can skyrocket. When fewer customers are browsing during the day on weekdays, prices drop dramatically. They frequently differ from weekday to weekday.

    Compare service providers

    Compare the costs of various providers. Price comparison websites are a valuable tool for this, but they can struggle to keep up if providers change their prices too frequently or too quickly. If you go to a merchant through a price comparison website, you may get a lower personalized price – after all, the merchant wants to rank as high as possible on the comparison portal, so they may have to lower the listed price there.

    Electronic vouchers or voucher codes are frequently used to entice customers by significantly lowering the purchase price of products and services. These vouchers can sometimes be found by using a search engine and entering the product and manufacturer’s names, as well as the word “voucher.” If you use a valid voucher with the appropriate online merchant, the generated price will be reduced. Any potential buyer who obtains these vouchers from third-party providers, on the other hand, usually pays with their personal information. You must, as always, balance the benefits and drawbacks.

    Observe

    Examine a product’s price over several hours, days, or even weeks – the differences can be significant. Ask your friend to look at the same product to see if there are any price differences due to personalized prices. If this is the case, the person with the lowest price can place the order.

    However, be aware that if a third party purchases something for you online or if you purchase something for someone else, the database will be impacted. If you buy expensive items for someone else, an algorithm may mistakenly believe you are more willing to pay than you do. While shopping online in the future, you may see higher personalized prices for products and services.

  • How to grow an XFS filesystem with pvcreate, vgextend, lvextend and xfs_growfs commands?

    How to grow an XFS filesystem with pvcreate, vgextend, lvextend and xfs_growfs commands?

    The methods below show how to extend a Volume Group (VG), a Logical Volume (LV), and a filesystem with a Physical Volume designated /dev/sda. (PV).

    • Create a PV from a free disk or partition (e.g., a partition named /dev/sda1):

    # pvcreate /dev/sda1

    • Extend the VG name vg. /dev/sda1 is the existing PV path.

    # vgextend vg /dev/sda1

    • Extend the LV and resize the underlying filesystem at the same time (the existing LV path is /dev/vg/lv00), which will be expanded by 150 GB.

    # lvextend -r -L +150G /dev/vg/lv00

    If you don’t run resize2fs or xfs_growfs on the block device after growing the Logical Volume, the file system size will be the same as it was before. To make use of the LVM’s extra capacity, use resize2fs or xfs_growfs to fill the partition with the current file system. You can now see the extended size of the file system in the df command output after resizing the file system.

  • How to change the ownership of httpd process?

    How to change the ownership of httpd process?

    • The owner and group of httpd-related processes is “apache” by default, as set in the apache configuration file (httpd.conf) shown below.

    User apache
    Group apache

    • You can confirm the user name and group of httpd process by using the ps command as follows.

    $ ps -aux | grep httpd
    root 9773 0.0 0.0 4520 685 pts/3 R+ 19:19 0:00 grep --color httpd
    root 9773 0.0 0.5 18564 5736 ? Ss Aug19 0:00 /usr/sbin/httpd
    apache 9773 0.0 0.2 18564 3068 ? S Aug19 0:00 /usr/sbin/httpd
    apache 9773 0.0 0.2 18564 3068 ? S Aug19 0:00 /usr/sbin/httpd

    • If you want to change the owner of the httpd, simply edit /etc/httpd/conf/httpd.conf and replace the User and Group directives with any other user/groupd.

    User newuser
    Group newgroup

    • Restart apache httpd service.

    systemctl restart httpd

    • Confirm the modification as follows.

    ps -aux | grep httpd

  • 14th-generation Intel Meteor Lake CPUs have already been spotted in an early photo

    14th-generation Intel Meteor Lake CPUs have already been spotted in an early photo

    Meteor Lake processors, which will be Intel’s 14th-generation chips (following Raptor Lake) and are due in 2023, have already been spotted and photographed, or at least test versions of the chips have.

    A close-up capture of a wafer of Meteor Lake test chips (see below), quite possibly of the M-Series, in this first sighting of Meteor Lake, which will be the first of Intel’s CPUs to blaze onto 7nm (finally) (low-power models).

    meteor lake

    Intel previously stated, manufacturing will begin in 2022, and shipping will begin in 2023 (recall that Meteor Lake was ‘taped in’ in May 2021, indicating that all separate design elements of the CPUs were complete at the time).

    Sapphire Rapids’ next-generation Xeon Scalable processors for servers were also spotted during Intel’s Fab 42 in Arizona. We also learned about Sapphire Rapids-X high-end desktop (HEDT) chips earlier this week and how they’ll be available in Q3 of 2022.

    Another exciting sign that Intel is on track for its Meteor Lake launch in 2023 is the discovery of test chips.

    These 14th-gen processors will be based on the Intel 4 process (7nm EUV), which is expected to provide a significant performance boost of 20% over the Intel 7 (Enhanced SuperFin) used in current-gen Alder Lake chips. A refresh of the latter is expected to bridge the gap between Intel 7 and Intel 4, which, as previously stated, will be Raptor Lake 13th-gen.

    Raptor Lake (along with Sapphire Rapids-X) is set to launch in Q3 of 2022, and it could be a significant step forward in terms of power efficiency.

  • Enable HTTP Strict Transport Security (HSTS) on Apache HTTPD

    This guide explains how to enable HTTP Strict Transport Security (HSTS) on Apache HTTPD.

    • The first step is to verify that Apache HTTPD headers module is enabled. Check the following text in /etc/httpd/conf.modules.d/00-base.conf or /etc/httpd/conf/httpd.conf.

    LoadModule headers_module modules/mod_headers.so

    • Add the following text in /etc/httpd/conf.d/ssl.conf to <VirtualHost *:443> virtual host or for each SSL enabled virtual host.

    Header always set Strict-Transport-Security "max-age=58099000; includeSubDomains"

    • The final step is to redirect traffic from the non-encrypted virtual host to HTTPS as follows:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    </IfModule>

    • Restart HTTPD service as follows:

    systemctl restart httpd

  • YUM Command Cheat Sheet

    YUM command is used for installing, querying, deleting, and managing CentOS/AlmaLinux packages in local and remote repositories. Use the following YUM Cheat Sheet as a quick reference for commands and options.

    [ninja_tables id=”6707″]

  • How to restrict find command within current filesystem?

    Use the below command to find files above 200M in / or in /opt. You can specify certain file system on the command line replacing / or /opt/

    # find / -xdev -size +200M

    # find /opt -xdev -size +200M

  • How to find files with specific permissions?

    You may need to find files with specific permissions in a Linux server for audit and security reasons. You can use the Linux find command to achieve this task.

    • The following command can be used to find files with (group or other or both) writable permission and SET UID set.

    # find / -perm /022 -and -perm -4000 -exec ls -ldb {} ;
                            ^^^^                       ^
                            | | | |                           |– So the SUID is 4
                            | | | |– Other is writable (2)
                            | | |–Group permission is writable (2)
                            | |– No owner permission mentioned (0)
                           |– As the logic is OR – group or other or both

    • You can use the following command to list files with other writable excluding sticky bit sets.

    # find / -perm -002 -and -perm -1000 -exec ls -ldb {} ;

    • Use the following command to list files with other writable excluding sticky bit set.

    # find / -perm -002 -not -perm -1000 -exec ls -ldb {} ;

    • The following command can be used to list files with (group + other) writable and SET GID set.

    # find / -perm -2022 -exec ls -ldb {} ;

    • The Find command to list files with (group + other) writable permission and SET UID set.

    # find / -perm -4022 -exec ls -ldb {} ;

    • Command to list files with other writable and sticky bit sets.

    # find / -perm -1002 -exec ls -ldb {} ;

    • Command to list files with other writable excluding sticky bit set.

    # find / -perm -002 -not -perm -1000 -exec ls -ldb {} ;