Retrace will reach End of Life on March 31, 2027. Click here to learn more.

Log tagging creates smarter application logs #awesomelogs

By: Alexandra
  |  July 30, 2015
Log tagging creates smarter application logs #awesomelogs

How many combined log statements do your applications and infrastructure produce in a day? 50,000? Over a million? Here at Stackify, our applications generate around 100 million log entries every day. Even after feeding them into Stackify’s powerful log management and filtering tools, it can be difficult to distill things down into meaningful, actionable diagnostics with an incredibly high volume of logs constantly arriving.

logs per hour

Figure 1: 3.75 million log statements… per hour.

Using #tags in your logging

By simply including hashtag-style keywords in your plain text log messages, you can vastly improve your ability to search, monitor, categorize, and understand events in your production software. When a log message arrives at Stackify, tags are automatically inferred from any word prepended with “#.” There is no limit to the number of tags that can be included in a log statement.

//Adding tags is as easy as adding a #

            log.Debug("Write to #queue complete");

Searching by tags

Once tagged log statements have been indexed, you can quickly and easily filter by the contained tags by searching for them or clicking anywhere that you see them highlighted in the output.

filter logs

Figure 2: Using our tag, we immediately filtered down to about 60 log statements per hour … much better!

You can also search by tags on the error dashboard to see all errors containing this tag. This provides all the great additional functionality of being able to see errors grouped by app, unique error, etc.

Error tracking

You can also use our built in field explorer to view all the tags in use and see how many times they occur. This alone can be helpful to see how many times a certain event occurs within a defined timeframe.

Tagging logs

Log Tagging suggestions

Tags can also be insanely useful to track a transaction across multiple apps and servers. By logging a tag for the same subsystem/subject across multiple different apps that are involved in a process, it greatly simplifies debugging. A good example of this a type of transaction that starts in a web app but gets passed via queue to some sort of background workers. Some simple tags can help link activity together across many boundaries.

To improve searching and filtering even more, we routinely include multiple tags in our log messages, often including a tag for a subsystem/subject, one for the operation, and one for state (e.g., #api #validatekey #failure). By following this convention, we can open up a range of options to quickly identify the log statements we care about. We can can get a broad view of all failing API operations via “#api #failure”, look at all “#validatekey” operations, or isolate this single event by searching for all three.

Special Stackify tags: #hastrace

Stackify also adds some special tags to your log statements. One great example of this is the #hastrace tag. This is used to help link APM profiling traces to the logging statements that occurred in the trace. This is an amazing feature to use from our log viewer. If you identify an interesting log statement, you can look for the “Trace” button to see the actual code profiling trace for that request. Learn more about Stackify APM.

Log trace

Monitoring your logs with tags

One of the real powers of tagging occurs when you combine it with Stackify log monitoring. The combination of tags and log monitors make it easy to maintain a high situational awareness for your applications, ensuring you always know if, when, and where your software is misbehaving.

To set up monitoring for your tagged log statements, go to Monitoring -> Log Queries and the Add New button. You can select a saved query or enter a new query. You can control how often the monitor runs, how far back in time it searches, and what the alerting thresholds are. For example, let’s pretend I wanted to be notified whenever my app has logged more than 500 entries containing “#api #validatekey #failure” in a 5 minute window. I could also change the monitoring alert duration to 15 minutes if I only want to be alerted if the problem persists for a length of time.

As you can see, tags provide a fast and direct way to get straight to the heart of the logs you care about. More importantly, they provide a reliable and powerful filter to combine with log monitoring to ensure that you can be proactively notified when something in your app needs a closer look.

 

 

Improve Your Code with Retrace APM

Stackify's APM tools are used by thousands of .NET, Java, PHP, Node.js, Python, & Ruby developers all over the world.
Explore Retrace's product features to learn more.

Learn More
situs toto pucuk4d indobet toto slot slot depo 10k toto toto toto bobatoto daftar logototo situs toto situs toto patentoto situs toto slot 4D toto bayitoto mawar800 login popotogel prize hongkong malam ini joker11 lingkartoto depo 5k panen100 semibola popo togel https://asupantoto.co/ slot pascol4d login pascol4d login sbobet88 sbobet88 https://nolimithoki.dev/ dinasti33 slot slot88 slot jepang slot depo 5k pucuk4d https://www.juara288.asia/ slot 4d RP888 toto toto pascol4d situs toto kari4d flokitoto slot gacor logototo slot depo 5k bobatoto bobatoto bobatoto sontogel mpo slot situs toto slot situs slot nobu99 logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo bobatoto istanaslot rp888 www.pajaktoto.io kari4d kari4d kari4d kari4d pascol4d pascol4d pascol4d toto slot slot gacor bento11 link KARI4D PUCUK4D pascol4d situs slot toto slot titi4d slot gacor toto toto slot toto jinhoki situs slot situs slot situs slot AMANAHTOTO https://www.asupan188.dev/ slot gacor gampang menang toto slot gacor bwo303 situs toto toto slot slot gacor slot88 slot gacor situs slot link slot situs toto slot gacor slot gacor pucuk4d PASCOL4D situs slot link slot pentaslot pajaktoto slotvip toto togel situs toto toto slot situs slot situs slot situs slot toto slot gacor slot777 situs slot link slot slot thailand situs judi bola situs toto roma77 slot jpmania toto228 RUSIA777 slot gacor POPOTOGEL : Situs Resmi Bandar Toto Togel Macau dengan Prediksi Gokil Pasti Akurat PARLAY slot gacor slot gacor slot gacor link slot BUNGASLOT slot slot gacor situs slot slot gacor slot gacor sejukbos situs slot link slot slot gacor gacor gacor Slot88 Slot88 coloktoto toto slot slot gacor situs slot gacor situs toto slot gacor toto toto toto slot gacor slot88 slot777 slot pulsa ayamtoto StreamEast slot777 slot88 link slot gacor situs gacor slot gacor slot gacor toto slot slot gacor leon188 slot gacor bandarqq jpmania slot gacor slot gacor Slot88 https://ini777gold.com nenek188 slot gacor slot gacor slot gacor NKRISLOT Slot88 situs slot slot gacor poker online slot88 rp888 Slot88
situs toto pucuk4d indobet toto slot slot depo 10k toto toto toto bobatoto daftar logototo situs toto situs toto patentoto situs toto slot 4D toto bayitoto mawar800 login popotogel prize hongkong malam ini joker11 lingkartoto depo 5k panen100 semibola popo togel https://asupantoto.co/ slot pascol4d login pascol4d login sbobet88 sbobet88 https://nolimithoki.dev/ dinasti33 slot slot88 slot jepang slot depo 5k pucuk4d https://www.juara288.asia/ slot 4d RP888 toto toto pascol4d situs toto kari4d flokitoto slot gacor logototo slot depo 5k bobatoto bobatoto bobatoto sontogel mpo slot situs toto slot situs slot nobu99 logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo bobatoto istanaslot rp888 www.pajaktoto.io kari4d kari4d kari4d kari4d pascol4d pascol4d pascol4d toto slot slot gacor bento11 link KARI4D PUCUK4D pascol4d situs slot toto slot titi4d slot gacor toto toto slot toto jinhoki situs slot situs slot situs slot AMANAHTOTO https://www.asupan188.dev/ slot gacor gampang menang toto slot gacor bwo303 situs toto toto slot slot gacor slot88 slot gacor situs slot link slot situs toto slot gacor slot gacor pucuk4d PASCOL4D situs slot link slot pentaslot pajaktoto slotvip toto togel situs toto toto slot situs slot situs slot situs slot toto slot gacor slot777 situs slot link slot slot thailand situs judi bola situs toto roma77 slot jpmania toto228 RUSIA777 slot gacor POPOTOGEL : Situs Resmi Bandar Toto Togel Macau dengan Prediksi Gokil Pasti Akurat PARLAY slot gacor slot gacor slot gacor link slot BUNGASLOT slot slot gacor situs slot slot gacor slot gacor sejukbos situs slot link slot slot gacor gacor gacor Slot88 Slot88 coloktoto toto slot slot gacor situs slot gacor situs toto slot gacor toto toto toto slot gacor slot88 slot777 slot pulsa ayamtoto StreamEast slot777 slot88 link slot gacor situs gacor slot gacor slot gacor toto slot slot gacor leon188 slot gacor bandarqq jpmania slot gacor slot gacor Slot88 https://ini777gold.com nenek188 slot gacor slot gacor slot gacor NKRISLOT Slot88 situs slot slot gacor poker online slot88 rp888 Slot88